Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

total up fields and write to filed in sql

Posted on 2007-03-21
2
Medium Priority
?
212 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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

604 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