Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query result and it's total 1

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
hi,

i've got a simple query (4 colums and about 6 records). All values are integers.

So, now I'd like to sum all the columns and write the total at the end. as means, records plus total of the records.

i cannot afford to execute 2 queries. somehow possible to do that with a union?

grateful for any hint

 
somehow possible to do that with a union?
Yes, like this:
SELECT col1, col2, col3, col4 FROM yourTable
UNION ALL SELECT SUM(col1), SUM(col2), SUM(col3), SUM(col4) FROM yourTable

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top