?
Solved

total up fields and write to filed in sql

Posted on 2007-03-21
2
Medium Priority
?
209 Views
Last Modified: 2010-05-18
I need to write an update query to total up 6 fields in a row and write them to one of the fields.

what I need is curmonth1 + curmonth2 + curmonth3 + curmonth4  + curmonth5 + curwages all put in the field curwages.   expamle   1 + 1+ 1 + 1+1+ 1 = 6 in the filed curwages.

I'd really would be greatful for some guildance with this problem

Thanks

0
Comment
Question by:running32
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 18763619
update yourtable
   set curwages = curwages + curmonth1 + curmonth2 + curmonth3 + curmonth4 + curmonth5

if at least 1 of the values could be null, but a COALESCE(curmonthN , 0) instead of simply curmonthN
0
 

Author Comment

by:running32
ID: 18763827
Thank you
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question