Last post Mar 25, 2020 08:59 AM by samwu
Mar 24, 2020 10:23 AM|jsshivalik|LINK
Select T1.Account, Sum(T1.Debit) - Sum(T1.Credit) Balance,
(Select AcctName from Oact T where T.AcctCode = T0.FatherNum) as Heading
from Oact T0
inner join JDT1 T1 on T0.AcctCode = T1.Account
inner join OJDT T2 on T1.TransId = T2.TransId
where T2.RefDate <= '2019/03/31'
group by T1.Account,T0.GroupMask
Oact.FatherNum' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Mar 24, 2020 12:36 PM|imapsp|LINK
Try changing the T0.GroupMask column to the T0.FatherNum column in the Group By clause.
Hope this help
Mar 25, 2020 08:59 AM|samwu|LINK
Oact.FatherNum' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
This is because you're selecting more columns from your query than you're using in your group by. All columns in your SELECT clause have to either be in your group by, or be an aggregate.
The solution is what imapsp says, changing the T0.GroupMask column to the T0.FatherNum column.