[thelist] table join for 4 tables

Ken Schaefer Ken at adOpenStatic.com
Thu Nov 3 17:05:09 CST 2005


Joins in the WHERE clause (all the ANDs you have below) were deprecated in
the SQL92 ANSI standard IIRC. Since the 1992 standard came out, JOINS are
supposed to be explicitly listed, so it'd be:

SELECT
	table1.status
	, table2.field1
	, table2.field3
FROM
	table1
INNER JOIN
	table2
ON
	table1.personID = table2.personID
WHERE
	table1.status = 10

-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Peter Brunone
(EasyListBox.com)
Sent: Friday, 4 November 2005 4:09 AM
To: thelist at lists.evolt.org; thelist at lists.evolt.org
Subject: Re: [thelist] table join for 4 tables

If they're all inner joins, how about just saying

SELECT table1.status, table2.field1, table2.field3, etc.
WHERE table1.status = 10
AND table1.Personid = table2.Personid
AND table1.shippingid = table3.shipppingid
etc.

----------------------------------------
 From: Unsupported Browser <unsupportedbrowser at gmail.com>
Sent: Thursday, November 03, 2005 10:57 AM
To: thelist at lists.evolt.org
Subject: [thelist] table join for 4 tables 

I'm pretty decent with single tables and even double tables, but I have one
query that has to join 4 tables and I am lost. here is the basic gist.
I need to look up information where table1 has a status of 10 and then I
need to get the personid from table1 and pull in the personal information
from table2, using the shippingid from table1 I need to get the address
(about 6 fields) associated with that from table3, then I need to get the
sku information from table4 using the skuid from table1.
 



More information about the thelist mailing list