473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to sum certain data in the same field

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
1 1871
nico5038
3,080 Expert 2GB
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

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
9
by: Sumanth Suri | last post by:
Hi, I want to setup one of the fields in a table so it increments sequentially(int data type). i.e the first record should be record 1 and the second one should be 2 and so on. This field will...
5
by: MX1 | last post by:
Here's an interesting one. I have a database that has user level security invoked. The design is normalized and I have one field in particular called Rep ID. Any thoughts on how I can allow all...
3
by: Chanchito | last post by:
hi there, I am seeking some guidance in regards to creating a query. I would like to be able to have the query display records that have had a certain amount of time pass since the time that is...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
1
by: Jason | last post by:
Hello, I was wondering if there was a way to only edit certain rows in a ASP.Net. I know how to only edit certain columns. But say for example, I want to lock a field if a certain date has...
1
by: Dixie | last post by:
I am looking for code that will check if a field (fieldname) exists in a certain table (tablename), then to add it if it does not. Can anyone guide me in the right direction. I think I can add...
8
by: Fabian Braennstroem | last post by:
Hi, I would like to remove certain lines from a log files. I had some sed/awk scripts for this, but now, I want to use python with its re module for this task. Actually, I have two different...
5
by: thisis | last post by:
Hi All, Hi All, (this is not the same topic as the my previous topic) What objects/methods/properties does VBScript offer for: Assuring/guarantee/make certain that ASP/VBSCript an ELEMENT...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.