ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
[PHP-DB] Re: Comma separated JOIN syntax
by Marc Ferguson other posts by this author
Dec 2 2005 12:09PM messages near this date
Re: [PHP-DB] Debugging | [PHP-DB] problem of transmitting variable from page to another page.
Hi Matt,

For the query style you would replace "ON" with "WHERE".  You won't use "ON" 
unless you use "JOIN"; they come together.

SELECT u.*, a.city FROM users u, addresses a WHERE u.id=a.user_id

Marc F.

""Matt Monaco"" <mmonaco3@[...].edu>  wrote in message 
news:99.57.21657.2CE8B834@[...]..
>  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 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved