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

How to sum certain data in the same field

P: 2
Hi I wanted to sum data in one field and output the data in another new field. For example, my data item is like this:

Expand|Select|Wrap|Line Numbers
  1. clientId   form  location value
  2. 1111     1         2         22.5
  3. 1111     2         3          22
  4. 1111     3         4         55
  5. 1111     4         1          22
  6. 1112
  7. ...
I want to sum the value with form 1, location 2 and value form 4, location 1 for each cleint. Is there any fomula can do this?

Thanks a lot for your help!
Feb 23 '07 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
Try:
select clientID, sum(value) from tblYours
where form & location IN ('12','41')
group by clientID

Best to change the fieldname "value" into another name as it's a reserved word and can cause trouble.

Nic;o)
Feb 25 '07 #2

Post your reply

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