hi,
I have a problem to translate this sql to hql:
Code:
select l.loan_id as loan,
p0.amount as amount,
sum(p1.amount) as amountPayed
from loans l
inner join account_histories p0
on l.loan_id = p0.loan
left outer join account_histories p1
on l.loan_id = p1.loan and p1.from_account = 1945
where p0.to_account = 1945 and p0.from_account = 1
group by l.loan_id
this code is what I have for now, but doesn't work.. when I have a "Loan" and this one have no "payments", hibernate ignores that
Code:
select
l.id,
p.amount,
sum(p1.amount)
from
Loan l inner join l.loanPayments p left join l.loanPayments p1
where (p.from.id=1 and p.to.id = 1945) and p1.from.id = 1945
group by l
somebody can help me?
.. sorry my english ..