[thelist] table join for 4 tables

Unsupported Browser unsupportedbrowser at gmail.com
Fri Nov 4 11:13:34 CST 2005


Thanks Brian and everyone for you input I used the first example, well I did
have to switch the fields and table location in the select statement. I
appoligize for the late reply as when it worked I fell into a code zone and
didnt come up for air until a little while ago.

On 11/3/05, Brian Cummiskey <Brian at hondaswap.com> wrote:
>
> Unsupported Browser wrote:
> > 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.
>
>
> this should work in mysql and mssql:
>
> select YOURFIELDS.table1, YOURFIELDS.table2, YOURFIELDS.table3,
> YOURFIELDS.table4 from table1
> left outer join table2 on table1.personid = table2.personid
> left outer join table3 on table1.shippingid = table3.shippingid
> left outer join table 4 on table1.skuid = table4.skuid
> where table1.status = '10'
>
>
> Assuiming no nulls in table1, you should pull what you need. Plug in
> the right YOURFIELDS elements for each table that you awnt to pull.
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list