我有2张桌子
表t_prj
包含列:
PID Date Particular
第二个表t_Adv
有列
PID Date Particular
我想合并并将两个表中的数据插入临时表日期
提前致谢
答案 0 :(得分:0)
创建临时表并将数据从一个表传输到它(对数据类型的假设:
create table #temp (PID int, Date date, Particular nvarchar(50))
insert into #temp
(PID, Date, Particular)
select PID, Date, Particular from t_prj
-- don't forget to drop the temporary table at the end
drop table #temp
答案 1 :(得分:0)
@ChrisBD答案的修改版本,
create table #temp (PID int, Date date, Particular nvarchar(50))
insert into #temp (PID, Date, Particular)
select PID, Date, Particular from t_prj
insert into #temp (PID, Date, Particular)
select PID, Date, Particular from t_Adv
SELECT *
FROM #temp
ORDER BY date
-- don't forget to drop the temporary table at the end
drop table #temp