Hi All,
I have a query which provides business partner balances.
I want to group these balances by their respective control accounts.
select T0.cardcode ,t2.GroupName,T0.Cardname, sum(t1.debit - t1.credit) As Balance
from ocrd T0 inner join JDT1 T1
on T0.cardcode = t1.shortname
inner join OCRG t2 on T0.GroupCode = t2.GroupCode
where t1.RefDate <= @PeriodToDate and T0.CardType = 'C'
group by T0.cardcode , T0.Cardname, t2.GroupName
Many thanks,
Millicent.