By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,197 Members | 1,057 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,197 IT Pros & Developers. It's quick & easy.

need row total and column total

P: 1
name jan feb
a 20 10
b 30 20
c 40 30
i have this data and i need this as
name jan feb total
a 20 10 30
b 30 20 50
c 40 30 70
total 90 60 150
Aug 31 '13 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,035
so you have:
Expand|Select|Wrap|Line Numbers
  1. select name, jan, feb
  2. from table
  3.  
and you want:
Expand|Select|Wrap|Line Numbers
  1. select name, jan, feb, jan+feb as total
  2. from table 
  3. union
  4. select 'total', sum(jan), sum(feb), sum(jan+feb)
  5. from table 
  6.  
(above is tested... ;)
Aug 31 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.