+-
mysql – 左连接多个表
基本上我想要加入3个表我已加入2个表

SELECT  * 
FROM    Shop_id i
        LEFT JOIN Shopper s 
           ON i.shopper_id = s.uid
WHERE   i.shopper_comp > 0 AND 
        i.editor_comp = 0
ORDER BY i.sid

我已经成功加入了Shop_id i和Shopper,我想将Clients添加到我认为的混合中

SELECT  * 
FROM    Shop_id i
        LEFT JOIN Shopper s, Clients c 
           ON i.shopper_id = s.uid AND i.cid = c.CID
WHERE   i.shopper_comp > 0 AND 
        i.editor_comp = 0
ORDER BY i.sid

我错了 – 请帮助

最佳答案
您需要为表客户端显式指定关键字LEFT JOIN.

SELECT * 
FROM   Shop_id i
       LEFT JOIN Shopper s
          ON i.shopper_id = s.uid 
       LEFT JOIN Clients c 
          ON i.cid = c.CID
WHERE  i.shopper_comp > 0 AND 
       i.editor_comp = 0
ORDER BY i.sid
点击查看更多相关文章

转载注明原文:mysql – 左连接多个表 - 乐贴网