union 的select 栏位是不是要一样呀?

解决方案 »

  1.   

    我原先的意思是希望搜索出SaleTmp表中没有并且RepairTmp表中也没有,但CarTmp表中有的CarFrameNumber字段,但是用not in 写性能不好,不知道用not exists应该怎么写?
      

  2.   

    选中Microsoft SQL Servers-->工具栏,工具-->选项-->高级-->查询超时-->改为0选中Microsoft SQL Servers-->工具栏,工具-->选项-->高级-->连接超时-->改为0
      

  3.   

    select ShortName,CarTmp.* from CarTmp left join Company on CarTmp.CompanyNumber=Company.CompanyNumber where not exists (select 1 from saleTmp where CarFrameNumber=CarTmp.CarFrameNumber ) and not exists(select 1 from Repairtmp where CarFrameNumber=CarTmp.CarFrameNumber)