<sa**********@gmail.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
hi !
could someone plz help me on this one,its kinda urgent
i hav a result set which looks something like this
country_code sum(amount)
1 100
2 123
3 213
i hav already used 'group by' clause to get the sum of amounts for
each country code
now i need to find the total sum of sum(amount) in the same query.How
do i do it???
i hav tried using an alias for the aggregated column and then trying to
get the sum of that column
but it does not work
plz help me out
regards,
Sangram
select workdept, sum(salary) as salary from emp group by workdept
union
select '-TOTAL' as workdept, sum(salary) as salary from emp
Note that the "-" in front of 'TOTAL" ensures that the TOTAL line will sort
after the other departments.