select cust_no1,cust_name1,cust_cardno1,cust_no,cust_name,cust_cardno
from xj_cust where 
where xcust_no1 not in (select cust_no from mx_cust)
and  cust_no like 'c%'

解决方案 »

  1.   

    上面写的多了一个where 抱歉
      

  2.   

    select cust_no1,cust_name1,cust_cardno1,cust_no,cust_name,cust_cardno
    from xj_cust  
    where cust_no1 not in (select cust_no from mx_cust)
    and  cust_no like 'c%'from xj_cust 
    一个表吗?感谢 !
      

  3.   

    select cust_no1,cust_name1,cust_cardno1,cust_no,cust_name,cust_cardno
    from xj_cust,mx_cust
    where xj_cust.cust_no1<>mx_cust.cust_no 
    and xj_cust.cust_name1<>mx_cust.cust_name 
    and  cust_no like 'c%'
    试试这个!
      

  4.   

    “不同”的 字段 感觉无法比较,如:
    table_a:a,b,ctable_b:a,d,e,f尽管有 相同的 字段 a,但还是会选择出来。因为 a.a<>b.d,a.b<>b.a。
      

  5.   

    如果要从表X中找出和表Y不同的记录(不如比较字段列名是A),只能查X一张表,如果引进了Y表,那么结果就是找出了:X中存在而在Y中不存在的记录 与 Y中所有记录 做交叉联接,就是笛卡尔联接
    所以语句应该是
    SELECT * FROM X WHERE X.A NOT IN (SELECT A FROM Y)
    WHERE X.B LIKE '%SA%'