这个hql如何写
我的HQL想写如下语句:select a.C.id from A a LEFT JOIN B b where a.C.id=b.C.id group by a.C.id having sum(a.money)<>sum(p.money)
其中A与C,B与C映射了many-to-one ,我想实现左连接查询(如果右边没有记录,则结果集不会为空)
因为此语句老是报错,请问hibernate高手,这句hql如何写?
[解决办法]
C在 A和B中是一个集合,你这a.aC.id指定会报错 你想要查什么?
[解决办法]
selsect id (select a.C.id as id,a.money as ad,b.money as bd from A a LEFT JOIN B b where a.C.id=b.C.id ) group by id having sum(ad)!=sum(bd)
[解决办法]