Need to join the following parent and 2 child tables:
Parent
ParentID
Date
Child1
ParentID
Child1ID
Qty1
Child2
ParentID
Child2ID
Qty2
When I run a query:
Select Parent.Date, Parent.ParentID, Child1.Qty1, Child2.Qty2
From Parent LEFT JOIN Child1 ON Parent.ParentID = Child1.ParentID LEFT JOIN Child2 ON Parent.ParentID = Child2.ParentID
I am getting a Cartesian product (if a number of rows in Child1 table is different from number of rows in Child2 table for a given Parent.ParentID). What I would like to get are nulls instead of non-distinct values e.g.:
Date ParentID Qty1 Qty2
09/12/02 1 100 200
09/12/02 1 150 250
09/12/02 1 130 null
Will appreciate help/suggestions.
Ttyre
Parent
ParentID
Date
Child1
ParentID
Child1ID
Qty1
Child2
ParentID
Child2ID
Qty2
When I run a query:
Select Parent.Date, Parent.ParentID, Child1.Qty1, Child2.Qty2
From Parent LEFT JOIN Child1 ON Parent.ParentID = Child1.ParentID LEFT JOIN Child2 ON Parent.ParentID = Child2.ParentID
I am getting a Cartesian product (if a number of rows in Child1 table is different from number of rows in Child2 table for a given Parent.ParentID). What I would like to get are nulls instead of non-distinct values e.g.:
Date ParentID Qty1 Qty2
09/12/02 1 100 200
09/12/02 1 150 250
09/12/02 1 130 null
Will appreciate help/suggestions.
Ttyre