开发者

Column in where clause is ambiguous - What does that mean?

I've come across this error in MySQL for the join clause but I'm fairly new to the JOIN argument and I'm not sure what this means. Can anyone help?

Column 'id' in where clause is ambiguous

SELECT * FROM (`venues`) 
JOIN `venues_meta` ON `venues开发者_如何学Go_meta`.`venue_id` = `venues`.`id` 
WHERE `id` = '12'


You need to fully qualify id because venues and venues_meta both have a column called id.


I think you want:

SELECT * FROM `venues` v, `venues_meta` m  where v.venue_id = m.id AND  m.id = '12'

(but be sure it's v.venue_id you want and not v.id)


Try this Code

SELECT v.*
FROM `venues` AS `v` 
INNER JOIN `venues_meta` AS `vm` ON `vm`.`venue_id` = `v`.`id` 
WHERE `v`.`id` = '12'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜