Grand Total

R

Ranjit kurian

Hi

I need a query to sum the column
example:

AGE
10
10
10
30 - the query should give the grandtotal as well the data
 
J

John Spencer

This is easy to do in a report. Just add a control to the report footer with
the control's source set to
=Sum(Age)

If you want to do it in a query and get the output you designated you will
need to use a union query.

SELECT Age, "Detail" as LineType
FROM YourTable
UNION ALL
SELECT Sum(Age), "Total" as LineType
FROM YourTable
ORDER BY LineType

Line Type is an added field that you will use as the primary source to force
the Total line to be the last line returned.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
C

ceesdatabase

Hello Ranjit,

You can try this :

SELECT person, age
FROM tblTable;
UNION
SELECT "total" AS person, Sum(age) AS total
FROM tblTable;

grtz
 
Top