Forum Moderators: coopster
Personal----(table 1's name)
ID
name
address
town
country
Hobbies----(table 2's name)
name_ID
hobby
Food----(table 3's name)
name_ID
food
if i run the following query that works fine.
select name,food from personal,food where personal.ID=name_ID;
result
+-----------+--------+
¦ name ¦ food ¦
+-----------+--------+
¦ John Dunn ¦ Currie ¦
+-----------+--------+
if i try and get data from all three tables using the following query
select name,food,hobby from personal,food,hobbies where personal.ID=name_ID;
I get the following error
ERROR 1052 (23000): Column 'name_ID' in where clause is ambiguous
what am i doing wrong
I believe you want to do something like...
select name,food,hobby from personal,food,hobbies where personal.ID=food.name_ID;
Because it doesn't know which name_ID you are referring to
for that i strongly advice to read and understand the docs:
[dev.mysql.com...]
i know it's not an easy topic at all but you run into joins quite fast while using multiple tables.