Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sum query does not work

Status
Not open for further replies.

BasicBoy

Programmer
Joined
Feb 22, 2008
Messages
156
Location
ZA
I have this query :

S$ = "Select sum(maintrans.quantity*maintrans.unitpriceexcl) as CatTotal, items.category from maintrans left join items on maintrans.itemno=items.orderitemno where items.category=" & rsCat!catno

The error says : You tried to exectue a query that does not include 'category' as part of an aggregate function.

Can somebody please help ?
Thanks
 




Hi,
Code:
S$ = "Select sum(maintrans.quantity*maintrans.unitpriceexcl) as CatTotal, items.category from maintrans left join items on maintrans.itemno=items.orderitemno where items.category=" & rsCat!catno [b]Group By items.category[/b]



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
As you already know the category:
Code:
S$ = "SELECT Sum(M.quantity*M.unitpriceexcl) AS CatTotal FROM maintrans M LEFT JOIN items I ON M.itemno=I.orderitemno WHERE I.category=" & rsCat!catno

Furthermore, the WHERE clause defeat the outer join ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top