#1052-where子句中的列'bookingId'不明确

时间:2019-11-07 09:58:20

标签: mysql sql

我想和两张桌子合影,但是我遇到了问题

这是我的sql语法

select * from booking as b,
booking_detail as bd 
WHERE bookingId = 9 AND b.bookingId = bd.bookingId

这是我出错了

1052-where子句不明确的列'bookingId'

2 个答案:

答案 0 :(得分:1)

Save使用别名

b.bookingId = 9

答案 1 :(得分:1)

将联接和别名用作bookinid列,因为该列在两个表中均可用

select * from booking as b join
 booking_detail as bd 
 on b.bookingId = bd.bookingId
  WHERE b.bookingId = 9