A表结构如下: username  usertelB表结构如下:
usertel现要求列出 A表中usertel字段的内容 不等于 B表usertel字段的所有记录,安A表的结构列出,即最后显示 username usetel 情况,我写了几句但不是理想的结果SELECT a.username, a.usertel FROM A a ,B b where a.usertel <> b.usertel

解决方案 »

  1.   

    select username ,usertel from A
    where usertel not in(select usertel from B)
      

  2.   

    select * from a where not exists(select * from b where a.usertel=b.usertel)
      

  3.   

    select username ,usertel from A
    where usertel not in(select usertel from B)
      

  4.   

    select * from a where not exists(select * from b where a.usertel=b.usertel)或者 select * from a inner join b on a.usertel<>b.usertel
      

  5.   

    select username ,usertel from A
    where usertel not in(select usertel from B)这个应该不错,试一下,有什么问题在发出来~~~```