Grand Total

  • Thread starter Thread starter Ranjit kurian
  • Start date Start date
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
 
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
 
Hello Ranjit,

You can try this :

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

grtz
 

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

Back
Top