Solved

total up fields and write to filed in sql

Posted on 2007-03-21
2
164 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
2 Comments
 
LVL 142

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now