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 inner join b on a.pk = b.pk;

Thing is I use the USING syntax all the time and name equivelent columns
in different tables the same to help me do this (I read somewhere that
this is good practice).

Is it still me, or should the USING syntax 'disambiguate' columns in the
select statement?


IMO, it "should" not - it "might", but no stronger desire.

Remember that we are talking about syntax here, not semantics!

It is a requirement of the SQL syntax that the column names in the "select list" be unique in the tables listed in the "from clause", and if the plain names are ambiguous, they must be qualified with the table name.

What you would like to see is a special case handling of an equality constraint. Sure this is possible, but as a consequence
SELECT pk FROM a, b WHERE a.pk = b.pk
would be valid (or "desired valid"), whereas
SELECT pk FROM a, b WHERE a.pk > b.pk
would be (and always remain) invalid. From a syntactic point, this would be very hard to argue.
I propose you simply use
SELECT a.pk FROM a, b WHERE a.pk = b.pk
and all is fine.


Regards,
Jörg

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



Reply via email to