Reputation: 11
I was looking for a solution in informatica powercenter which could allow me to add a total row at the bottom of the output.I am currently using code in Oracle Sql format and in Sql developer application
Current output
StudentName History Math Science
John Doe. 10. 20. 30
John Watts. 30. 50. 20
Wanted output
StudentName History Math Science
John Doe. 10. 20. 30
John Watts. 30. 50. 20
Total. 40. 70. 50
Upvotes: 0
Views: 412
Reputation: 7387
You can try this as well in informatica.
SQ ->... -> EXP ------>|
| UNI -> TGT
|-> AGG-->|
Upvotes: 1
Reputation: 1270401
The simplest method is probably union all
. If you really want the row last, then:
select tt.*
from ((select studentname, history, math, science
from t
) union all
(select 'Total', sum(history), sum(math), sum(science)
from t
)
) tt
order by (case when studentname = 'Total' then 1 else 2 end) desc,
studentname
Upvotes: 0