有两个表 例如
现在要查询 payee , payee的userId, drawee ,drawee的userId
最终结果显示, 张三 1 李四 2
该怎么编写sql语句
有两个表 例如
现在要查询 payee , payee的userId, drawee ,drawee的userId
最终结果显示, 张三 1 李四 2
该怎么编写sql语句
SELECT trade.payee, user1.userId, trade.drawee, user2.userId
FROM trade
JOIN user AS user1 ON trade.payee = user1.username
JOIN user AS user2 ON trade.drawee = user2.username
望采纳。