当我使用左连接时,我获得了比原始表更多的行

时间:2018-03-05 15:37:50

标签: sql-server

SELECT a.COMPID
    ,a.A_COMPID
    ,a.A_CLIENTID
    ,a.A_CUSTNAME
    ,b.CLIENTID
    ,b.CLIENTNAME
FROM A_CUSTOMERS AS a
LEFT JOIN CLIENTS AS b ON b.COMPID = a.COMPID
    AND b.A_CLIENTID = a.A_CLIENTID
WHERE a.COMPID = 1000

0 个答案:

没有答案