我有表LS_CLIENT_TRANS
CODE_CLIENT OTHER_CLIENT
4444 4444
4444 8585
和表格CLIENT
CODE_CLIENT ADRESS
4444 RR
8585 GG
我怎么能得到:
CODE_CLIENT OTHER_CLIENT ADRESS
4444 4444 RR
4444 8585 GG
当我使用
时 SELECT *
FROM LS_CLIENT_TRANS
LEFT JOIN CLIENT ON LS_CLIENT_TRANS.CODE_CLIENT = CLIENT.CODE_CLIENT
我得到了:
CODE_CLIENT OTHER_CLIENT ADRESS
4444 4444 RR
4444 8585 RR
答案 0 :(得分:1)
SELECT *
FROM LS_CLIENT_TRANS
LEFT JOIN CLIENT ON LS_CLIENT_TRANS.OTHER_CLIENT = CLIENT.CODE_CLIENT
答案 1 :(得分:0)
JOIN
上的{p> ON l.OTHER_CLIENT = c.CODE_CLIENT
就像这样:
SELECT
l.CODE_CLIENT,
l.OTHER_CLIENT,
c.Adress
FROM LS_CLIENT_TRANS l
LEFT JOIN CLIENT c ON l.OTHER_CLIENT = c.CODE_CLIENT
答案 2 :(得分:0)
SELECT t.CODE_CLIENT, t.OTHER_CLIENT, c.ADDRESS
FROM LS_CLIENT_TRANS t
JOIN CLIENT c ON t.OTHER_CLIENT = c.CODE_CLIENT