先有2个表一个个人信息表(A),一个人最后上线时间表(B)
    select a.name b.time from 个人信息表 a,最后上线时间表 b where a.id  in (select b.id from 最后上线时间表)
这样可以查到上过线的人数,我想查到哪些人从来没有上线过
应该怎么查好像用not in查出来的不对

解决方案 »

  1.   

    select a.name from 个人信息表 a where not exists(select 1 from 最后上线时间表 where id=a.id)
      

  2.   

    select a.* from a where id not in (select id from b)
      

  3.   


    select a.name b.time 
    from 个人信息表 a left join 最后上线时间表 b on a.id=b.id
    wehre b.id is null
      

  4.   

    select a.name b.time from 个人信息表 a,最后上线时间表 b where 關聯條件 and isnull(b.time,'')=''
      

  5.   

    select a.name from 个人信息表 a where not exists(select 1 from 最后上线时间表 where id=a.id)
      

  6.   


    select a.name from 个人信息表 a where not exists(select 1 from 最后上线时间表 where id=a.id)
      

  7.   

    select a.name from 个人信息表 a where not exists(select 1 from 最后上线时间表 b where a.id=b.id)
      

  8.   

    select a.* from a where id not in (select id from b)
    应该是这样的
      

  9.   

    select a.* from a where id not in (select id from b)