0

Hi all,

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?

Thanks

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by whiteyoh
0

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'

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

0

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

0

Hi,

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
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.