Jump to content

SQL Query to Update Specific Price


kdash1228

Recommended Posts

I want to update existing Specific Prices based on the Wholesale/Cost Price for items that are active. Below is an example of the final calculation.

This is the Excel calculation for when I am manually determining the Fixed Price:
RoundUp((CostPrice*0.2)+CostPrice,0)+3
=RoundUp[(34.02*.2)+34.02]+3
=RoundUp(40.824)+3
=41+3
=44

I believe I will need to use the following Database tables/fields:

ps_product.active
ps_product.wholesale_price
ps_specific_price.price
ps_specific_price.id_product
ps_product.id_product


Can someone let me know if my query is correct or if I should make any changes?

UPDATE ps_Specific_Price
INNER JOIN ps_Product
ON ps_specific_price.id_product = ps_product.id_product
SET ps_Specific_Price.Price = CEILING((ps_Product.Wholesale_Price*0.2)+ps_Product.Wholesale_Price)+3
WHERE ps_Product.Active= 1

Thank You!!

image.png.bde59efaec770801d8d1e118b4634ab0.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...