基本上我想要加入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 s我想将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
我错了 - 请帮助
答案 0 :(得分:5)
您需要为表格LEFT JOIN
明确指定关键字clients
。
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
答案 1 :(得分:1)
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