select TableA.*, TableB.*, TableC.*; >> from TableA ; >> Left Outer Join TableB ; >> on TableA.Ident = TableB.Ident ; >> and TableA.FKey = TableB.FKey ; >> Left Outer Join TableC ; >> on TableA.Ident = TableC.Ident ; >> where TableB.FiltB = 1 ; >> and TableC.FiltC = 1 ; >> group by TableA.Ident >>>
select TableA.*, TableB.*, TableC.*; from TableA ; Left Outer Join TableB ; on TableA.Ident = TableB.Ident ; and TableA.FKey = TableB.FKey ; Left Outer Join TableC ; on TableA.Ident = TableC.Ident ; having (isnull(TableB.FiltB) = 1 or TableB.FiltB); and (isnull(TableB.FiltC) or TableB.FiltC = 1)Gives the desired result at the cost of a Cartesian explosion that the having clause must filter. Is there a way to get the filtering done in the join and still get all five rows?