If the are columns with the same name, for example id
, when using the wildcard character the database will return error 1052
:
Solution is to define each column:
SELECT property.id, personal.id, spouse.id FROM property JOIN personal ON personal.id = property.id JOIN spouse ON spouse.id = property.id;
As explained in the linked documentation above. Read also:
By the way do not use the MySQL API (mysql_query()
& co.) switch to MySQLi or PDO: