Re: amPiguous!

2005-05-15 Thread Dan Bolser
On Sat, 7 May 2005, Jochem van Dieten wrote: >On 5/7/05, Dan Bolser wrote: >> On Sat, 7 May 2005, Jochem van Dieten wrote: >>>On 5/7/05, Dan Bolser wrote: >>> select pk from a inner join b using (pk); ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!! Is this

Re: amPiguous!

2005-05-07 Thread Jochem van Dieten
On 5/7/05, Dan Bolser wrote: > On Sat, 7 May 2005, Jochem van Dieten wrote: >>On 5/7/05, Dan Bolser wrote: >> >>> select pk from a inner join b using (pk); >>> >>> ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!! >>> >>> Is this a bug, or is it like this for a reason? It drives me nu

Re: amPiguous!

2005-05-07 Thread Dan Bolser
On Sat, 7 May 2005, Jochem van Dieten wrote: >On 5/7/05, Dan Bolser wrote: >> >> Why are columns included in the join between two tables ambigious? > >Because MySQL does not follow the SQL standard (ISO/IEC 9075-2:2003). > > >> select pk from a inner join b using (pk); >> >> ERROR 1052 (23000):

Re: amPiguous!

2005-05-07 Thread Jochem van Dieten
On 5/7/05, Chris wrote: > Somethign else to think about as well, look at this slight modification: > > select pk from a left join b using (pk); > > > Now, it's not likely this is a valid query for your table structure It is very likely it is. It is even an example in the MySQL manual. > but,

Re: amPiguous!

2005-05-07 Thread Jochem van Dieten
On 5/7/05, Dan Bolser wrote: > > Why are columns included in the join between two tables ambigious? Because MySQL does not follow the SQL standard (ISO/IEC 9075-2:2003). > select pk from a inner join b using (pk); > > ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!! > > Is this a

Re: amPiguous!

2005-05-07 Thread Joerg Bruehe
Hi! Dan Bolser wrote: [[...]] I would have said... select pk from a inner join b on a.pk = b.pk; (probably pk was a bad choice for an example column name). Using the ON syntax instead of the USING syntax makes my problem look even more silly than it already is, i.e. just say select a.pk from a inne

Re: amPiguous!

2005-05-06 Thread Chris
Somethign else to think about as well, look at this slight modification: select pk from a left join b using (pk); Now, it's not likely this is a valid query for your table structure, but, in this instance, a.pk and b.pk are not necessarily the same. b.pk could potentially be NULL while a.pk was n

Re: amPiguous!

2005-05-06 Thread Rhino
gt; To: Sent: Friday, May 06, 2005 7:14 PM Subject: Re: amPiguous! > On 7/05/2005 11:00 a.m., Rhino wrote: > > Actually, the error message is misleading. There is nothing that I would > > call ambiguous in your query: you have a syntax error. The join should be > > written:

Re: amPiguous!

2005-05-06 Thread Dan Bolser
;b.col2' with real column names >>> >>> >>>from tables a and b respectively. >> >> >>>Rhino >>> >>>- Original Message - >>>From: "Dan Bolser" <[EMAIL PROTECTED]> >>>To: >>>Sen

Re: amPiguous!

2005-05-06 Thread Eric Bergen
- Original Message - From: "Dan Bolser" <[EMAIL PROTECTED]> To: Sent: Friday, May 06, 2005 6:50 PM Subject: amPiguous! Why are columns included in the join between two tables ambigious? It seems that they should *not* be ambigious! Like this select pk from a inner jo

Re: amPiguous!

2005-05-06 Thread Dan Bolser
hat MySQL should know from the join that a.pk and b.pk are the same, >so it doesn't matter which one it uses. Exactly! Afterall a.pk = b.pk! However, I can imagine how this could become somewhat tricky with the ON syntax. > >-Simon > > > >> >> - Original Mes

Re: amPiguous!

2005-05-06 Thread Dan Bolser
ould the USING syntax 'disambiguate' columns in the select statement? > >Rhino > >- Original Message - >From: "Dan Bolser" <[EMAIL PROTECTED]> >To: >Sent: Friday, May 06, 2005 6:50 PM >Subject: amPiguous! > > >> >> Why a

Re: amPiguous!

2005-05-06 Thread Eric Jensen
; and 'b.col2' with real column names >from tables a and b respectively. > >Rhino > >- Original Message - >From: "Dan Bolser" <[EMAIL PROTECTED]> >To: >Sent: Friday, May 06, 2005 6:50 PM >Subject: amPiguous! > > > > >>

Re: amPiguous!

2005-05-06 Thread Simon Garner
MAIL PROTECTED]> To: Sent: Friday, May 06, 2005 6:50 PM Subject: amPiguous! Why are columns included in the join between two tables ambigious? It seems that they should *not* be ambigious! Like this select pk from a inner join b using (pk); ERROR 1052 (23000): Column 'pk' in field l

Re: amPiguous!

2005-05-06 Thread Rhino
mn names from tables a and b respectively. Rhino - Original Message - From: "Dan Bolser" <[EMAIL PROTECTED]> To: Sent: Friday, May 06, 2005 6:50 PM Subject: amPiguous! > > Why are columns included in the join between two tables ambigious? > > It seems th

amPiguous!

2005-05-06 Thread Dan Bolser
Why are columns included in the join between two tables ambigious? It seems that they should *not* be ambigious! Like this select pk from a inner join b using (pk); ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!! Is this a bug, or is it like this for a reason? It drives me nuts,