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!

SUM at the end of a select

Status
Not open for further replies.

clarissa1996

Technical User
Jan 31, 2002
78
CH
I need to compute the sum of a column at the end of a select statement.
How is this possible ?

Thanks. Clarissa
 
or use a UNION, if you have mysql 4

[tt] select "detail"
, foo
, bar
from yourTable
union all
select "total"
, sum(foo)
, sum(bar)
from yourTable
order by 1[/tt]

nice that the word "detail" sorts before the word "total"


rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top