Thanks
V

On Fri, Oct 2, 2009 at 11:08 AM, Mark Goodge <m...@good-stuff.co.uk> wrote:

> Victor Subervi wrote:
>
>> Hi;
>> I get the following error:
>>
>> *SQL query:*
>>
>> SELECT ID, Item
>> FROM products
>> JOIN categories ON categories.ID = products.Category
>> LIMIT 0 , 30;
>>
>>  *MySQL said:*
>>  #1052 - Column 'ID' in field list is ambiguous
>>
>> Please note the error is about ambiguity. "products" has an ID field and
>> so
>> does "categories". If I run the statement taking out the "ID" from the
>> select, it runs. So, where is the ambiguity??
>>
>
> The ambiguity is that the select clause doesn't know which table you're
> referring to, since you're joining two of them that both have an 'ID' field.
> This will work:
>
> SELECT products.ID, Item
> FROM products
> JOIN categories ON categories.ID = products.Category
> LIMIT 0 , 30;
>
> Mark
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=victorsube...@gmail.com
>
>

Reply via email to