I have 4 tables that all have a foreign key of dev_id. I want to SELECT * from all of them but it keeps saying "ambigious column".
Can anybody advise how to overcome this?
This is my statement that returns 0 results, but theres definitly one there
SELECT * FROM tbl_dev_dilligence, tbl_dev_dilligence_business, tbl_dev_dilligence_director WHERE tbl_dev_dilligence.dev_id = '115' AND tbl_dev_dilligence.dev_id = '115' AND tbl_dev_dilligence_director.dev_id = '115'
Select * tries to concatenate all the columns from all the tables, but every column has a dev_id, he cannot return that 4 times. Change it to
SELECT tbl_dev_dilligence.*, tbl_dev_dilligence_business.*, tbl_dev_dilligence_director.* (I think)
A lesser problem: tbl_dev_dilligence.dev_id = '115' appears twice. I'm guessing one should be tbl_dev_dilligence_business
Thanks for the response. your right, i got it working with the following
SELECT dev_tel FROM tbl_dev_dilligence, tbl_dev_dilligence_business, tbl_dev_dilligence_director WHERE tbl_dev_dilligence.dev_id = 115 AND tbl_dev_dilligence_business.dev_id = 115 AND tbl_dev_dilligence_director.dev_id = 115
replacing dev_tel with a * (forgot to take it out)