[英]How to get the name of one table using the id in another table, using PHP
I have two tables. 我有两张桌子。
booking_details
and vehicle_details
. booking_details
和vehicle_details
。 in booking_details
, V_ID
is the foreign key and I want to fetch the V_name
column from Vehicle-details
with a particular user login. 在
booking_details
, V_ID
是外键,我想使用特定的用户登录名从Vehicle-details
获取V_name
列。 Please help me guys. 请帮助我。 tell me how could I solve this problem.
告诉我如何解决这个问题。
SELECT * FROM booking_details
Join vehicle_detail
on booking_details.V_Id = vehicle_detail.V_Id
ORDER BY vehicle_detail.V_Name ASC
I tried this query. 我试过这个查询。 it will fetch both the values but I don't know how to put the where condition in it.
它会获取两个值,但我不知道如何将where条件放入其中。
SELECT * FROM booking_details
Join vehicle_detail
on booking_details.V_Id = vehicle_detail.V_Id
WHERE (...)
ORDER BY vehicle_detail.V_Name ASC
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.