Aggregate Function?

rschultz

Registered User.
Local time
Today, 22:54
Joined
Apr 25, 2001
Messages
96
I tried to create the following query:
SELECT Sum([NWT]/2000) AS YTDNWTons, Sum([CTOT]) AS YTDAmount, Count([NWT]) AS [YTDNo of Customers], tblScaleData.Ticket, tblScaleData.PROD
FROM tblScaleData
WHERE (((tblScaleData.Ticket) Like "sc1*") AND ((tblScaleData.PROD)="VEG1" Or (tblScaleData.PROD)="Wood1"));

but I'm getting an error that says:"You tried to execute a query that doesn't include the specified expression 'Ticket' as part of an aggregate function". But 'Ticket' is one of the fields in the table. What does this mean?
 
tblScaleData.Ticket, tblScaleData.PROD

If ticket is actually field, you are using it as a table - tblScaleData.Ticket means Field "tblScaleData" is from table "Ticket"
 
>>You need a group by clause in a totals query

Ah, that was it. I added a 'Totals' line and put "Expression" in the Expressins columns (interesting how that works<grin> ) and Group in the grouped one and "Where" in the ones that were just plain fields. and it worked.

Thanks
 

Users who are viewing this thread

Back
Top Bottom