Re: Correct way to join and as well as preserve all parent table entries in a join with many tables!!

From: radkri <chikkubhai_at_gmail.com>
Date: Sat, 16 Feb 2008 15:04:21 -0800 (PST)
Message-ID: <7f6c09d5-6c0e-4f2d-a3b9-1671f9e6feb3@o77g2000hsf.googlegroups.com>


Thank you for the response.

I did use the following syntax, but was still wondering if I were doing it the right way and also most efficient way:

select parentTable.field1, parentTable.field2, childTable1.field3, childlTable1.field4,

      childTable2.field5, newChildComboTable.field5, newChildComboTable.field6
from parentTable
LEFT JOIN childTable1 ON parentTable.PKField = childTable1.FKField LEFT JOIN childTable2 ON parentTable.PKField = childTable2.FKField LEFT JOIN (select childTable4.filed5, childTable5.field6 from childTable4

                  LEFT JOIN childTable5 ON childTable4.PKField1 =
childTable5.FKField1) newChildComboTable
                  ON parentTable.PKField = newChildComboTable.FKField
where
...

order by
....

See how I am left joining some of the independent child tables to make sure that I do not loose any of the entries at all. Is this the right way or what are the correct and optimised way to do it?

Thanks Received on Sat Feb 16 2008 - 17:04:21 CST

Original text of this message