【发布时间】:2015-10-20 10:20:56
【问题描述】:
我使用的是 sql server 2012。
我在下面写了一个选择查询,它工作正常。但是我不确定如何将查询返回的数据插入另一个表 (tblTempPrices)?
我的插入
;insert into tblTempPrices(DateEntry, DatePrice, ISIN, Price, PriceSource, SecurityType, TableCheck)
下面的查询有效
with ret as
(
select distinct ISIN, Price
from tblFI_Benchmark_R
where DateEntry = '2015-10-19'
),
stat as
(
select distinct ISIN, Price
from tblFI_Benchmark_S
where DateEntry = '2015-10-19'
),
allSec as
(
select * from ret
union
select * from stat
)
select '2015-10-20', '2015-10-19', ISIN, Price, 'BARC', 'FixedIncome', 'PCF' from allSec
【问题讨论】:
标签: sql sql-server sql-server-2012