現在有兩個表, ECI_Customer,CAT_Customer  裡面各有一個字段 customer_num, CUSTID  兩字段裡有不同的數據
現在以這兩字段為依據把customer_num沒有的,CUSTID裡有的數據找出來,並把表中的某些字段也找出來
我這樣寫:
SELECT     CUSTID, PASSPORT_NO, NAME, ADDR, TELNO
FROM         CAT_Customer
WHERE  not exists(select CUSTID, PASSPORT_NO, NAME, ADDR, TELNO  from CAT_Customer  where ECI_Customer.customer_num=CUSTID AND ECI_Customer.re= PASSPORT_NO and ECI_Customer.[1_name]=NAME and ECI_Customer.[1_addr_1]=ADDR and ECI_Customer.[1_phone]=TELNO)為什麼牠報錯說:無法繫結多重部份(Multi-Part),識別碼“ECI_Customer.[1_name]”
        無法繫結多重部份(Multi-Part),識別碼“ECI_Customer.[1_addr_1]”
        
        

解决方案 »

  1.   

    SELECT           CUSTID,   PASSPORT_NO,   NAME,   ADDR,   TELNO 
    FROM                   CAT_Customer 
    WHERE     not   exists(select   CUSTID,   PASSPORT_NO,   NAME,   ADDR,   TELNO     from   CAT_Customer     where   ECI_Customer.customer_num=CUSTID   AND   ECI_Customer.re=   PASSPORT_NO   and   ECI_Customer.[1_name]=NAME   and   ECI_Customer.[1_addr_1]=ADDR   and   ECI_Customer.[1_phone]=TELNO) 两个红色的中,有一个应该是ECI_Customer吧?
      

  2.   

    你這樣的查詢是亂的,完全沒有搞清楚你要什么,和子查詢的作用!ECI_Customer.[1_name]=NAME   and   ECI_Customer.[1_addr_1]=ADDR   and   ECI_Customer.[1_phone]=TELNO這些字段壓根兒沒定義,怎么用啊!!子查詢只能處理多個,你這個查詢是拿表 CAT_Customer 中的 CUSTID,PASSPORT_NO,NAME,ADDR,TELNO 聯合起來去對比表CAT_Customer中的CUSTID,   PASSPORT_NO,   NAME,   ADDR,   TELNO 字段,沒辦法對!