【发布时间】:2017-01-15 13:40:37
【问题描述】:
我有两个文件已批量导入到两个日期重叠的表中。现在我想将两个表中的数据移动到一个新表中,但删除重叠的日期。这是我的代码:
-- Pull across data from P1-10 and exclude out of scope dates
SELECT *
INTO I_Inventory
FROM I_Inventory_P10_Temp
WHERE [date] >= '01/01/2016' and [date] <= '10/31/16'
-- Pull across data from P11-12 and exclude out of scope dates
SELECT *
INTO I_Inventory
FROM I_Inventory_P12_Temp
WHERE [date] >= '11/01/2016' and [date] <= '12/31/16'
但是这不起作用,因为它说在第一次选择后表已经存在。有人可以让我知道如何解决这个问题吗?我对 SQL 很陌生。
【问题讨论】:
-
查看 UNION ALL。
标签: sql sql-server database