我想加入两张桌子,但我遇到了问题
这是我的 SQL 语法
select * from booking as b,
booking_detail as bd
WHERE bookingId = 9 AND b.bookingId = bd.bookingId
这是我得到的错误:
#1052 - where 子句中的列 'bookingId' 不明确
我想加入两张桌子,但我遇到了问题
这是我的 SQL 语法
select * from booking as b,
booking_detail as bd
WHERE bookingId = 9 AND b.bookingId = bd.bookingId
这是我得到的错误:
#1052 - where 子句中的列 'bookingId' 不明确
使用别名b.bookingId = 9
select * from booking as b join
booking_detail as bd on b.bookingId = bd.bookingId
WHERE b.bookingId = 9
对 bookinid 列使用连接和别名,因为该列在两个表中都可用
select * from booking as b join
booking_detail as bd
on b.bookingId = bd.bookingId
WHERE b.bookingId = 9