LEFT OUTER JOIN in NHibernate with SQL semantics
Posted
by Yuval
on Stack Overflow
See other posts from Stack Overflow
or by Yuval
Published on 2010-04-01T09:37:29Z
Indexed on
2010/04/01
9:43 UTC
Read the original article
Hit count: 384
Hi,
Is it possible to use HQL/ICritera to produce a query with the same semantics as the following SQL query:
select table1.A, table2.B, count(*) from table1
left join (select table2.parent_id, table2.B from table2 where table2.C = 'Some value') as table2
on table2.parent_id = table1.id
group by table1.A, table2.B
order by table1.A
In particular, what I'd like is to receive rows (that is, objects) from table1 that have no matching rows in table2. However, I only get the rows from table1 that have matches in table2. Is this the meaning of 'LEFT JOIN' in HQL? And if so, how can I get it to join on a subquery?
Tnx.
© Stack Overflow or respective owner