Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Multi Lookup Table Joins

From: Baron Schwartz <baron(at)xaprb.com>
Date: Sun Sep 30 2007 - 11:04:19 EDT


Chris W wrote:
> I often find that I have more than one column in a tale that is an
> integer ID used to join to a lookup table. If there is only one Join to
> do it is to do something like this....
>
> SELECT t.data, l.group
> FROM table t JOIN lookuptable l USING (groupID)
> WHERE whatever
>
> however if I need to join more than one that syntax wont work because
> the second join will be trying to join to the first lookup table no the
> main table. Is there a way around this or do I need to just do joins
> using this syntax....
> SELECT x, y, z
> FROM table t, lookupA la, lookupB lb
> WHERE t.aID = a.aID AND t.bID = b.bID
>
>

You can use ON clauses and explicitly qualify which table the columns are in.

-- 
MySQL General Mailing List
For list archives: 
http://lists.mysql.com/mysql
To unsubscribe:    
http://lists.mysql.com/mysql?unsub=lists@pantek.com
Received on Sun Sep 30 11:05:33 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 10:12:58 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library