I have an SQL statement that counts by field AMPORDERFK and groups by fields ALTACCTNBR, SLUGLINE, and BASEAMOUNT. While this part works great, I want to know how to insert the rest of my fields into the query without them grouping the count. If I include them in the select statement I get an error. Below is the code for what I have working and code for what I think is right, as well as the error.
The correct code
The code with added fields under select:
The error that the query throws:
"You tried to execute a query that does not include the specified expression 'REALLINES' as part of an aggregate function."
Any help with this will be greatly appreciated.
thanks,
Layth
The correct code
Code:
SELECT [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].BASEAMOUNT, [Folio Sepation by rate].SLUGLINE,
Count([Folio Sepation by rate].AMPORDERFK) AS CountofAMPORDERFK
FROM [Folio Sepation by rate]
Group BY [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].BASEAMOUNT, [Folio Sepation by rate].SLUGLINE;
The code with added fields under select:
Code:
SELECT [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].BASEAMOUNT, [Folio Sepation by rate].SLUGLINE,[Folio Sepation by rate].REALLINES, [Folio Sepation by REALCOLS,
Count([Folio Sepation by rate].AMPORDERFK) AS CountofAMPORDERFK
FROM [Folio Sepation by rate]
Group BY [Folio Sepation by rate].ALTACCTNBR, [Folio Sepation by rate].BASEAMOUNT, [Folio Sepation by rate].SLUGLINE;
The error that the query throws:
"You tried to execute a query that does not include the specified expression 'REALLINES' as part of an aggregate function."
Any help with this will be greatly appreciated.
thanks,
Layth