Link to home
Create AccountLog in
Avatar of enrique_aeo
enrique_aeo

asked on

Add a total row in store procedure

how do Add a total row to in a  store procedure, my query show;
meses enero febreo
item1   100     200
item2   150      250
I need to show
meses enero febreo
item1   100     200
item2   150      250
total     250     450
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

here we go:
select mese, enero, febreo
  from yourtable
union all
select 'total', sum(enero), sum(febro)
  from yourtable

Open in new window

Avatar of sbagireddi
sbagireddi

select sum(enero),sum(febreo)
ASKER CERTIFIED SOLUTION
Avatar of brad2575
brad2575
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer