neellotus07 (10/8/2012)
Hi All,I want to show data from four tables on the basis of left outer join.All tables contain common column "a_code" on which i want to apply left outer join.
Pls tell me correct syntax to join these tables i will be very thankfull to you.
thanx
Neel
Here's the simplest example, three tables all left joined to one. It assumes that Table1 contains all of the values of a_code which will be encountered in the other three tables.
SELECT something
FROM Table1 t1
LEFT OUTER JOIN table2 t2 ON t2.a_code = t1.a_code
LEFT OUTER JOIN table3 t3 ON t3.a_code = t1.a_code
LEFT OUTER JOIN table4 t4 ON t4.a_code = t1.a_code
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden