select * from #temp1
union 
select * from #temp2

解决方案 »

  1.   

    delete #temp2 from #temp1 a where a.itemno=#temp2.itemno and a.time=#temp2.time
      

  2.   

    我只是想得到
    #temp2中的两条记录
    ItemNo Time    Description
    3      16:00   CCC
    3      17:00   CCC
    你的这个sql会出现5条记录!!!
      

  3.   

    select b.* from #temp2 b left join #temp1 a on a.itemno=b.itemno and a.time=b.time
    where a.itemno is null
      

  4.   

    delete #temp2 where itemno+time in (inertsect(select itemno+time from #temp1,select intemno_time from #temp2))
      

  5.   

    select * from #temp2 A
    where not exists (select * from #temp1 where itemno = A.itemno and time = A.time)
      

  6.   

    感谢 CrazyFor(蚂蚁) 、 tj_dns(愉快的登山者) 、liuyun2003(流云——小小菜鸟)
    CrazyFort和liuyun2003的方法都可以用,tj_dns的方法也行,不过还是不如前两位的方法。
    哎,做项目太累,思维也迟钝了。
      

  7.   

    select * from #temp2 A
    where not exists (select 1 from #temp1 where itemno = A.itemno and time = A.time)