Solved

How do I perform mathematical update from fields using select statement

Posted on 2012-03-13
2
335 Views
Last Modified: 2012-03-13
I would like be able to update multiple fields with a mathematical function. For example in this example query I would like each field to be 76% of the original fields value.

select CHARGE from SHCOSTS where COST_CODE='R'and L_WEIGHT < 5.001
which output's


5.490
5.840
5.930
6.070
6.250
5.830
6.220
6.490
6.680
6.770
5.940
6.740
7.080
7.440
7.750
6.200
6.880
7.300
7.780
8.090
6.490
7.260
7.690
8.070
8.390
6.580
7.410
7.900
8.420
8.780
6.690
7.660
8.460
9.060
9.540
20.620
22.900
24.930
27.220
29.590
5.020
5.070
5.100
5.160
5.200
20.620
22.900
24.930
27.220
29.590
5.090
5.140
5.170
5.230
5.290
7.830
8.460
9.940
11.190
12.720
8.070
8.700
10.210
11.800
13.410
14.150
15.400
15.950
17.050
18.150
22.250
23.400
24.600
25.750
26.550
7.830
8.460
9.940
11.190
12.720
8.070
8.700
10.210
11.800
13.410
0
Comment
Question by:elusivedisc
[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 9

Accepted Solution

by:
macarrillo1 earned 500 total points
ID: 37715650
Try:

update SHCOSTS
set CHARGE = CHARGE *0.76
where COST_CODE='R'and L_WEIGHT < 5.001
0
 

Author Closing Comment

by:elusivedisc
ID: 37715873
Worked perfect thank you.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
(sql serv16)ssis 2016 question/check 1 101
add criteria to query in VB, Access 2003 2 29
query output (script) from a stored procedure 4 36
SQL Select Query help 1 36
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

735 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