select * from tb1 where name='jack' and id not in(select number from tb2)

解决方案 »

  1.   

    select id ,name,st
    from A
    where name = 'jack' and id not in (select number from B)
      

  2.   

    select * from A表
     where name='jack'
      and id not in (select  number from B表)
      

  3.   

    select 
        * 
    from 
        A 
    where 
        not exists(select 1 from B where number=A.number) 
        and 
        name='jack'
      

  4.   

    select 
        * 
    from 
        A 
    where 
        not exists(select 1 from B where number=A.ID) 
        and 
        name='jack'
      

  5.   

    谢谢大家了  还要加个转换 select 
        * 
    from 
        A 
    where 
        not exists(select 1 from B where number=cast(A.ID as char(10)) 
        and 
        name='jack'