0

我有表 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
4

3 回答 3

1
SELECT *
FROM LS_CLIENT_TRANS
LEFT JOIN CLIENT ON LS_CLIENT_TRANS.OTHER_CLIENT = CLIENT.CODE_CLIENT
于 2012-11-16T21:17:48.693 回答
0

JOINON 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

SQL 小提琴演示

于 2012-11-16T21:18:35.097 回答
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
于 2012-11-16T21:20:36.023 回答