Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Join six tables with single SELECT statement
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01316996
Message ID:
01317006
Views:
14
Hi Elgin,

This problem could be solved with derived tables. e.g. here is the principal

select ST1.Fields..., ST2.Fields, ... from (select T1.Fields, T2 Fields from Table1 T1 full outer join table2 T2 on ... && Don't put where condition since they convert OUTER JOIN into the INNER JOIN) ST1 full join (...) ST2 etc.

Still it can become too complex.

>All
>
>I want to join various fields from six tables with one SELECT statement. Can that be done?
>
>I need it to be a full join because I need all records from all tables that match my criteria. I have started a SELECT statement with five of the six tables as shown below. I think I need to use the FORCE keyword here to control the join evauluation, do I not?
>
>In the results I am looking at now a record in the "furanppm" table is being excluded that should be there. I have checked this record and I can't find a record in any of the other tables that match its date. Could that be why it is not included? I thought the FULL JOIN would handld that and that means to bring it into the result set regardless.
>
>Here's my current work:
>
>
>select v.custid, v.upsino, v.datinp, v.optemp, v.pktemp, ;
>	   l.dielectric, l.neut_no, l.ift, l.h20, ;
>	   d.hydrogen, d.methane, d.ethylene, ;
>	   i.aluminum, i.copper, i.iron, ;
>	   f.hydroxymth, f.furfuryl, f.furaldehyd ;
>	   from force visual v ;
>	   full join (liquid l full join dga d on d.custid = l.custid and d.upsino = l.upsino and d.puldat = l.puldat ;
>	   full join icp i on i.custid = d.custid and i.upsino = d.upsino and i.puldat = d.puldat ;
>	   full join furanppm f on f.custid = d.custid and f.upsino = d.upsino and f.puldat = d.puldat) on ;
>	   l.custid = v.custid and l.upsino = v.upsino and v.datinp = l.puldat ;
>	   where v.custid = "SC100234" and v.upsino = "0000004" ;
>	   order by v.upsino, v.datinp
>
>
>Thanks a million.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform