$query= mysqli_query($db,"SELECT a.*, b.collection_id , c.contract_id,
d.customer_name FROM rentals_invoice
AS b INNER JOIN rental_collection as a ON (b.collection_id = a.collection_id)
AS c INNER JOIN rental_contract as b ON (c.contract_id = b.contract_id)
AS d INNER JOIN customer_info as c ON (d.customer_id = c.customer_id)");
我有桌子a,b,c,d
'a'的键为'b'
'b'的键为'c'
'c'的fkey为'd'
我想从所有这些数据中获取数据,而且我不知道如何在单个查询中通过内部联接或任何其他类型的联接获取数据。
我是初学者。
答案 0 :(得分:1)
您放错了别名。您正在覆盖别名。您还可以使用using
来简化此操作。
FROM rentals_invoice AS b
INNER JOIN rental_collection as a using(collection_id)
INNER JOIN rental_contract AS c using(contract_id)
INNER JOIN customer_info as d using(customer_id)");
我还将使用与实际表名相关的别名。 a
,b
,c
等都没有用,以后很难诊断。
答案 1 :(得分:0)
No module named 'reverse_geocoder'
No module named 'geopy'
感谢所有帮助或尝试帮助我的人,我了解了JOIN。