Update records on a SQL Table

Engr. Matthew

New member
Local time
Today, 23:05
Joined
Feb 27, 2021
Messages
14
I have a client they entered records on a Products Table. Every other necessary information has been entered only selling_Price is left out. Now, they asked me if it is possible to update the entire Products table’s selling_Price with the Value of Purchase_Price plus 30%.

The Selling_Price = Purchase_Price +(Purchase_Price*30%)
Is there SQL Update Syntax to this.
 
On SQL Server

SQL:
UPDATE TheTableName
SET Selling_Price = Purchase_Price * 1.3

Replace TheTableName with the correct name for the table.
EDIT : Actually re-reading your post I think one of us has the calculation wrong? I assumed you just wanted 30%
Purchase price + (Purchase price *30%) is a much bigger increase?
 
Purchase price + (Purchase price *30%) is a much bigger increase?

Equivalent.

100 + (100 * .3) = 100 + 30 = 130
100 * 1.3 =130
 
If the selling price can be calculated from the purchase price, it is recommended NOT to store it in the table.
 

Users who are viewing this thread

Back
Top Bottom