472,111 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

SUM function two different fields in one table

I am trying to add the values of two fields in one table. Not sure how to get the SUM function to make this work.
Mar 27 '07 #1
6 4632
ronverdonk
4,258 Expert 4TB
For each row:
Expand|Select|Wrap|Line Numbers
  1. SELECT fielda+fieldb AS Total FROM table;
for total table:

Expand|Select|Wrap|Line Numbers
  1. SELECT SUM(fielda)+SUM(fieldb) AS Total FROM table,
Ronald :cool:
Mar 27 '07 #2
How do I work this into other criteria that will sort on other unique fields?
Mar 27 '07 #3
N/M that last post...I got it.
Mar 27 '07 #4
ronverdonk
4,258 Expert 4TB
Glad to be of help. See you next time.

Ronald :cool:
Mar 27 '07 #5
Hi guys,

i have the same problem but the fields are in a diffenret table, could u help me please????
Apr 20 '07 #6
sorry, i forgot tell that i have to check the name as well before sum the values...

thanks


Danylo
Apr 20 '07 #7

Post your reply

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

Similar topics

3 posts views Thread by Dalan | last post: by
18 posts views Thread by jimfortune | last post: by
11 posts views Thread by Geagleeye | last post: by
14 posts views Thread by Phil Stanton | last post: by
luckysanj
20 posts views Thread by luckysanj | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.