| | |
Pricing Update Query
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Sep 2009
Posts: 4
Reputation:
Solved Threads: 0
Hi Guys
I have an e-commerce website. Two of the columns are for the pricing of products. What I would like to do is update the price ('prodprice') directly from the cost price ('prodcostprice').
It would be nice to set a certain markup according to price range. eg. $0-$1000 = 20% $1001-$2000 = 18% etc. and have the ability to put in a cost price, and the system automatically work out the price depending on price range.
In a previous dicussion I have being given:
It seems to generate an error.
Does anyone have a solution or update?
If I could get this to work, what could be easier.. just copy in your new cost prices and update you retail prices automatically. Super
Thanks
Marc
I have an e-commerce website. Two of the columns are for the pricing of products. What I would like to do is update the price ('prodprice') directly from the cost price ('prodcostprice').
It would be nice to set a certain markup according to price range. eg. $0-$1000 = 20% $1001-$2000 = 18% etc. and have the ability to put in a cost price, and the system automatically work out the price depending on price range.
In a previous dicussion I have being given:
sql Syntax (Toggle Plain Text)
UPDATE `isc_products` WHERE `prodcostprice` >= 0 AND WHERE `prodcostprice` <= 1000 SET `prodprice` = (`prodcostprice` * 1.20); UPDATE `isc_products` WHERE `prodcostprice` >= 1001 AND WHERE `prodcostprice` <= 2000 SET `prodprice` = (`prodcostprice` * 1.18);
It seems to generate an error.
Does anyone have a solution or update?
If I could get this to work, what could be easier.. just copy in your new cost prices and update you retail prices automatically. Super
Thanks
Marc
Last edited by peter_budo; Sep 23rd, 2009 at 4:36 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Looks to me like you've got WHERE in there twice. An SQL statement should only have 1. (unless your using join, subqueries, etc.)
I havent tested this but try:
notice, I removed your 2nd WHERE. hope that helps.
I havent tested this but try:
MySQL Syntax (Toggle Plain Text)
UPDATE `isc_products` WHERE `prodcostprice` >= 0 AND `prodcostprice` <= 1000 SET `prodprice` = (`prodcostprice` * 1.20);
Don't pay data charges. txtFeeder.com is a free way to read the web on your mobile, and avoid data charges! **Now txtFeeder has a wireless note feature! Make notes on the go!
-Kyle Getson
-Kyle Getson
•
•
Join Date: Sep 2009
Posts: 15
Reputation:
Solved Threads: 1
sql Syntax (Toggle Plain Text)
UPDATE `isc_products` SET `prodprice` = (`prodcostprice` * 1.20) WHERE `prodcostprice` >= 0 AND `prodcostprice` <= 1000 ; UPDATE `isc_products` SET `prodprice` = (`prodcostprice` * 1.18) WHERE `prodcostprice` >= 1001 AND `prodcostprice` <= 2000 ;
If prodcostprice can have decimal places then you need to edit to handle values between 1000 and 1001
Last edited by peter_budo; Sep 23rd, 2009 at 4:36 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Update query in event procedure for Form (Visual Basic 4 / 5 / 6)
- Update query after cfmail (ColdFusion)
- UPDATE query problem (ASP.NET)
- How can i update a query that have more than 3 tables using adodc in vb? (Visual Basic 4 / 5 / 6)
- UPDATE query not working properly... (PHP)
- Need update query--Remove the coma "," (PHP)
- Error while trying the update query (ASP)
Other Threads in the MySQL Forum
- Previous Thread: debugging mysql on windows
- Next Thread: MySQL Multiple Inner Joins
Views: 600 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for changingprices, mysqlcolumnupdating, priceupdating






