Solved

How do I perform mathematical update from fields using select statement

Posted on 2012-03-13
2
314 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
2 Comments
 
LVL 9

Accepted Solution

by:
macarrillo1 earned 500 total points
Comment Utility
Try:

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

Author Closing Comment

by:elusivedisc
Comment Utility
Worked perfect thank you.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

15 Experts available now in Live!

Get 1:1 Help Now