gpt4 book ai didi

mysql - 在第二个左连接 MYSQL 中使用一个左连接表中的列

转载 作者:行者123 更新时间:2023-11-29 10:29:48 25 4
gpt4 key购买 nike

假设我们需要这样的查询:

SELECT table1.c1, table1.c2, c3, c4 FROM table1
LEFT JOIN (
SELECT c1II, c3II as c3 FROM table2) joined1 ON table1.c1 = joined1.c1II

LEFT JOIN (
SELECT c1III, c4II as c4 FROM table3 WHERE c4 > joined1.c3) joined2 ON table1.c1 = joined2.c1II

我尝试运行此查询并收到以下错误:

Error in query (1054): Unknown column joined1.c3 in where clause

我应该怎么做才能使其正常工作?

最佳答案

希望这有帮助

SELECT table1.c1, table1.c2, c3, c4 
FROM table1
LEFT JOIN table2 ON table1.c1 = table2.c1II
LEFT JOIN table3 ON c4 > table2.c3 AND table1.c1 = table3.c1II

关于mysql - 在第二个左连接 MYSQL 中使用一个左连接表中的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47619552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com