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.
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.
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
140 Points
518 Posts
Error - invalid in the select list because it is not contained in either an aggregate function or...
Mar 24, 2020 10:23 AM|jsshivalik|LINK
Hi
Oact.FatherNum' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Thanks
Participant
1120 Points
297 Posts
Re: Error - invalid in the select list because it is not contained in either an aggregate functio...
Mar 24, 2020 12:36 PM|imapsp|LINK
Hi,
Try changing the T0.GroupMask column to the T0.FatherNum column in the Group By clause.
Hope this help
Contributor
3370 Points
1409 Posts
Re: Error - invalid in the select list because it is not contained in either an aggregate functio...
Mar 25, 2020 08:59 AM|samwu|LINK
Hi jsshivalik,
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.
Best regards,
Sam