[thelist] MS Table Join Question (from Excel)

Luther, Ron Ron.Luther at hp.com
Mon May 9 13:36:59 CDT 2011


The redoubtable RonL. asked such a question:

>>Select a buncha junk 
>>FROM Table_1 AL1, Table_2 AL2, table_3 AL3, Customer AL4 WHERE 
>>(AL1.PART=AL2.Sku AND AL1.Code=AL3.CODE AND AL4.CUSTOMER_NUMBER=AL1.CUSTOMER_NUMBER)  
>>AND (other conditions)

>>The problem is that this AL4 customer reference table may not be complete ... so I need a >>leftjoin/rightjoin on that last bit in the where clause to pull in all records from table AL1 regardless of >>whether they match up in AL4 or not.

>>Can I buy a clue on the syntax?


And found his own answer!  (Well, technically, I cheated and created the answer using a separate gui based reporting technology that allowed me to peek under the skirt and check out the answer!)

Which is ...

Select a buncha junk 
FROM Table_2 AL2, table_3 AL3, Table_1 AL1 LEFT OUTER JOIN Customer AL4 
ON (AL1.CUSTOMER_NUMBER=AL4.CUSTOMER_NUMBER)
WHERE 
(AL1.PART=AL2.Sku AND AL1.Code=AL3.CODE)  
AND (other conditions)

Didn't know about that "on" splifflety goodness.

Sorted!

Cheers,
RonL.




More information about the thelist mailing list