On Tue, 13 Nov 2007 12:44:00 -0800, Don
Interesting. If I understand you correctly you have a grouping level
with a sum, and you want to sort the groups by that sum, for example
from highest to lowest.
ProductCategory = X
<items in this product cat>
Sum Sold: $999
ProductCat = P
<items in this product cat>
Sum Sold: $888
ProductCat = S
<items in this product cat>
Sum Sold: $777
To do that, you would want to add the sum expression to your query,
and sort by it, descending.
Off the cuff:
select tblSales.*
, tblProductCats.Name
, Sum(tblSales.Price*tblSales.Qty) as SumSold
from tblSales
inner join tblProductCats on <etc>
order by Sum(tblSales.Price*tblSales.Qty) DESC
-Tom.