Query Grand Total

  • Thread starter Thread starter Slayer
  • Start date Start date
S

Slayer

I presume this question has been asked over and over again and I hope is
very simple to answer. Is there a way of creating a query where the results
as well as the grand total of the results total column is shown. e.g.

ProdName***Units***Prize***Total
product_1***5***1.5***7.5
product_3***2***0.5***1
product_4***10***2***20
GrandTotal************28.5

Thank you

JK
 
Slayer said:
I presume this question has been asked over and over again and I hope is
very simple to answer. Is there a way of creating a query where the results
as well as the grand total of the results total column is shown. e.g.

ProdName***Units***Prize***Total
product_1***5***1.5***7.5
product_3***2***0.5***1
product_4***10***2***20
GrandTotal************28.5

That would more appropriately be done in a form or report, not a query.
All rows in a query must have an identical structure. I suppose some sort
of UNION query setup could accomplish this, but I see no point in trying to
produce this output in a query grid when it is so much easier to do in a
form or report.
 
I agree with the sentiments. Queries are for selecting, filtering, sorting,
grouping of data and are not for formatted output. I like the idea of a
Union.

If you have a look at northwind and enter the following you'll see what Rick
means

SELECT Products.ProductName as Product, Products.UnitPrice
FROM Products
UNION ALL
SELECT "Grand Total" AS Product, Sum(Products.UnitPrice) AS SumOfUnitPrice
FROM Products
GROUP BY "Grand Total";
 
Thanks John

The belowmentioned union query is exactely what I was looking for. Maybe my
example was not correct but the GrandTotal was what I was looking for.

Thank you again
 
Back
Top