select fieldlist ;
from Parent ;
left join Child1 ;
on Parent.KeyID = Child1.Parent_ID ;
left join Child2 ;
on Parent.KeyID = Child2.Parent_ID ;
left join Child3 ;
on Parent.KeyID = Child3.Parent_ID ;
left join Child4 ;
on Parent.KeyID = Child4.Parent_ID ;
where some_conditions ;
group by ... ;
order by ... ;
into cursor crsResults
>I am wanting to build a report based on parent table and all related records
>in 4 child tables. Some child tables might not have related records
>so I would just want the emtpy or null value for the field I am trying to get from it.
>Can 1 sql statement do this or will i have to build one cursor with key field and loop through each child table and populated report table?
>I am trying inner/outer joins but if all criteria does not match, nothing
>is pulled into query?
>
>Any help would be greatly appreciated.. (also some resources on bulding SQL select statements!)
>
>Thanks,
>Ronnie
Mark McCasland
Midlothian, TX USA