From: Peter Brawley Date: November 29 2005 1:32am Subject: Re: comma-separated JOINS List-Archive: http://lists.mysql.com/mysql/192285 Message-Id: <438BAFCA.4030508@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Matt, >When using JOINS by the simply supplying a comma separated list of tables in >the FROM clause, is the ON argument normally associated with a join intended >to be addressed in the WHERE clause, or should ON still be used? There's no ON clause for a join specified by a WHERE clause, and that's one reason specifiying joins with JOIN ... ON .. is almost always preferable--it entirely disambiguates the join for the writer, readers, and those others who later will have to divine what you meant :-) . PB ----- Matt Monaco wrote: >When using JOINS by the simply supplying a comma separated list of tables in >the FROM clause, is the ON argument normally associated with a join intended >to be addressed in the WHERE clause, or should ON still be used? > >// Comma separated join >SELECT u.*, a.city FROM users u, addresses a WHERE u.id=a.user_id; > >// Actual JOIN clause >SELECT u.*, a.city FROM users u INNER JOIN addresses a ON u.id=a.user_id; > > >// Query style in question >SELECT u.*, a.city FROM users u, addresses a ON u.id=a.user_id; > >If not ON, is there at least another viable argument? The reason I'm >interested is for a query involving 5 or 6 tables and WHERE arguments which >do not deal with the relationships. I would like to assure the efficiency >of this query. > > >Thanks in advance, >Matt > > > > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.8/184 - Release Date: 11/27/2005