I am querying the inner join of three tables using the following query.
Two of the tables have columns named "name1". I am getting the following error.
Column 'exName' in field list is ambiguous
The "name1" columns are foreign key so the information should be identical. Can anyone suggest a compact way around this?
$result = mysql_query("SELECT name1,name2,name3 FROM `table1` INNER JOIN `table2` ON table2.name1=table1.PrimaryKey INNER JOIN `table3` ON table3.name1=table1.PrimaryKey");
You need to qualify your column names with the table names.
SELECT table1.name1, table2.name1, etc.