Skip to Content
avatar image
Former Member

Query Problem- trying to group by Item Group

Hi All

I am creating a report which details the Item code, Item Description, In stock amount, Commited amount and the Price one particular price list. I want this to be grouped by the Item Group. The query below is the one I have created. It works well until i add anything into the Group by section.

SELECT T1.[ItemCode],

T1.[ItemName],

T2.[OnHand],

T2.[IsCommited],

T0.[Price]

FROM ITM1 T0 INNER JOIN

OITM T1 ON T0.ItemCode = T1.ItemCode

INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode

INNER JOIN OITB T3 ON T1.ItmsGrpCod = T3.ItmsGrpCod

INNER JOIN OPLN T4 ON T0.PriceList = T4.ListNum

WHERE T4.[ListName] = 'Selling Prices GBP'

GROUP BY T3.[ItmsGrpNam]

I receive the following error when exectued:

Column 'OITM.ItemCode' is invalid in the select list because it is not contained in either an aggregate function or the GOUP BY clause

Can anyone help?

Thanks in advance

Gail

Edited by: Gail Patterson on Apr 3, 2008 1:32 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Apr 03, 2008 at 11:42 AM

    Hi,

    Please remove the group by function and try it out. Since you are not using any sum function on it.

    Thanks

    SAGAR

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks Sagar

      I slelected the ItmsGrpNam as suggested then I just sorted it on this field. Not quite what I was looking for but it does the job it needs to do.

      Thanks again for your help.

      Gail