gpt4 book ai didi

SQL-左连接问题

转载 作者:行者123 更新时间:2023-12-03 02:23:48 24 4
gpt4 key购买 nike

SELECT 
tb1.booking_ref, tb1.investor, tb2.cost, tb3.product
FROM
tb1, tb3 LEFT JOIN tb2
ON
tb1.booking_ref = tb2.booking_ref
AND
tb1.investor = tb2.investor
AND
tb1.investor = '12345'
WHERE
tb1.location = tb3.location

由于对 tb3 的引用而出现上述查询错误 - 没有它们它也能正常工作。

有人知道为什么吗?

最佳答案

SELECT 
tb1.booking_ref, tb1.investor, tb2.cost, tb3.product
FROM
tb1
inner join tb3
on tb1.location = tb3.location
left join tb2
on tb1.booking_ref = tb2.booking_ref
and tb1.investor = tb2.investor
WHERE tb1.investor = '12345'

关于SQL-左连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3865951/

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