locked
Error - invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. RRS feed

  • Question

  • User-797751191 posted

    Hi

    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.

    Thanks

    Tuesday, March 24, 2020 10:23 AM

All replies

  • User452040443 posted

    Hi,

    Try changing the T0.GroupMask column to the T0.FatherNum column in the Group By clause.

    Hope this help

    Tuesday, March 24, 2020 12:36 PM
  • User288213138 posted

    Hi jsshivalik,

    jsshivalik

    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

    Wednesday, March 25, 2020 8:59 AM