Solved

total up fields and write to filed in sql

Posted on 2007-03-21
2
195 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 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

730 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