My mistake; I wasn't aware of the 'using' clause being an alternative syntax
for 'on' in MySQL's versio of MySQL. I mostly use DB2 and that is *not*
valid in DB2's SQL.

Rhino

----- Original Message ----- 
From: "Simon Garner" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
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:
> >
> >     select pk from a inner join b on a.col1 = b.col2
> >
> > Of course, you need to replace 'a.col1' and 'b.col2' with real column
names
> > from tables a and b respectively.
> >
> > Rhino
>
> Not true, his join syntax is correct.
>
> select pk from a inner join b using (pk)
>
> is the same as saying
>
> select pk from a inner join b on a.pk = b.pk
>
> However, MySQL is complaining about the "select pk" part because it
> doesn't know whether to select a.pk or b.pk. I think what Dan is arguing
> is that MySQL should know from the join that a.pk and b.pk are the same,
> so it doesn't matter which one it uses.
>
> -Simon
>
>
>
> >
> > ----- Original Message ----- 
> > From: "Dan Bolser" <[EMAIL PROTECTED]>
> > To: <mysql@lists.mysql.com>
> > 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 list is ambiguous!!!
> >>
> >>Is this a bug, or is it like this for a reason? It drives me nuts,
because
> >>it is not ambigious (as far as I can tell). Am I a fool?
> >>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 04/05/2005
>
>



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.5 - Release Date: 04/05/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to