> Let me put it another way. Let's say A to C is one to many. (A.cs is a
> collection of C.)
> 
> select a, c
> from A as a
> left join a.cs as c
> where a.p1 = 2 and c.p1 = 3
> The above won't return A's that have no C's (or no C's with p1 = 3). I need
> all A's with p1 = 2 regardless of the existence of related C's with p1 = 3.
> 

I'm not 100% sure, but I think this should work:

select a, c
from A as a
left join a.cs as c
where a.p1 = 2 
and (c.id is null or c.p1 = 3)

-- 
Luis Fernando Planella Gonzalez

Reply via email to