Return total of totals?

F

Fred

Hi guys, I would like to know if this is possible. I have a price column, in
my query I return this as a total row, so it shows the totals for each item I
listed in my query. I want to know if it's possible to also have a final row
or column that shows that grand total for each total returned. Thanks.
 
J

John Spencer

You can do this in a report.

You can do this using a Union query where you eliminate the grouping a second
query that returns the totals

SELECT 1 as Detail, Product, Sum(Price) as TotalPrice
FROM SOMETABLE
GROUP BY 1, Product
UNION ALL
SELECT 2, "Total", Sum(Price)
GROUP BY 2, "Total"
ORDER BY Detail, Product

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 
F

Fred

Perfect. Thanks John!

John Spencer said:
You can do this in a report.

You can do this using a Union query where you eliminate the grouping a second
query that returns the totals

SELECT 1 as Detail, Product, Sum(Price) as TotalPrice
FROM SOMETABLE
GROUP BY 1, Product
UNION ALL
SELECT 2, "Total", Sum(Price)
GROUP BY 2, "Total"
ORDER BY Detail, Product

John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top