MySQL Error: #1052 - Column 'id' in field list is ambiguous
I get this when I post the SQL into phpMyAdmin. I guess I don't really know what the word ambiguous means. Can anyone tell me what is the problem?
[highlight="sql"]
SELECT id, title
FROM td as a
INNER JOIN post AS cc on cc.id = a.id
WHERE a.plt IN('79');
[/highlight]
SQLZOO, Error 1052 Column 'name' in field list is ambiguous
This will maybe help you out.
It means that ID and/or Title exist in both tables - which one do you want to select? Rewrite it like so in order to fix the problem:
[highlight=mysql]
SELECT a.id, cc.title
FROM td AS a
INNER JOIN post AS cc ON cc.id = a.id
WHERE a.plt IN('79');
[/highlight]
thanks guys..
Your both CC and TD tables have ID named columns
So while in the SELECT list, you must use the table name or alias name then column name like " CC.Id " or " TD.Id "
There are currently 3 users browsing this thread. (0 members and 3 guests)
Bookmarks