想实现except功能,但是SQL 2000不支持,用not exists它倒去掉了一些记录,有什么办法可以代替它?例如:select * from vote
except
select * from vote2结果如下:2 基本满意 2
3 不满意 2
4 非常满意 9
5 非常满意 9
select * from vote as a 
where not exists(select * from vote2 where Opinion=a.Opinion and NumVote=a.NumVote)结果如下:2 基本满意 2
3 不满意 2

解决方案 »

  1.   

    select * from vote as a 
    where not exists(select * from vote2 where Opinion=a.Opinion and NumVote=a.NumVote) 
    union all
    select * from vote2 as a 
    where not exists(select * from vote where Opinion=a.Opinion and NumVote=a.NumVote)
      

  2.   

    select * from vote as a 
    where not exists(select * from vote2 where id=a.id and 
    Opinion=a.Opinion and NumVote=a.NumVote) 
      

  3.   

    或者用 left joinselect a.*
    from vote a left join vote2 b on b.Opinion=a.Opinion and b.NumVote=a.NumVote)
    where b.Opinion is null