简体   繁体   中英

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_meta`.`venue_id` = `venues`.`id` 
WHERE `id` = '12'

您需要完全限定id ,因为venuesvenues_meta都有一个称为列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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM