0

I have recently taken over the running of an e-commerce website. Once in a while i will need to increase the prices of certain products by any given percenatge. The products all have a code starting with 3 letters and then digits. for instance: ffc1234, ffc1245, dcc4544, dcc5799, vff300, and so on. I may only have to update the dcc prices one month, and the ffc the next. I need to know the UPDATE query to be able to do this.

The product codes are in a column called prod_code and the prices that need to be updated are in a column called prod_prices.

I need to run an UPDATE query in PHPMYADMIN. ... can anyone help?

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by bubbafunk1
0

Welcome bubbafunk1.
So you are not exeuting update query. Isn't it? Write your update statement so we can help you.

0

Basically, I only started learning MYSQL 2 days ago, so I dont really know much.

Thanks for your reply!

I just want to update a table called products, and change the prices in a column called p_price by adding 10% to the prices of the products whos p_code start with ffc, dde and bgg.

This is what I think the code should look like, but obviously... it should work.

UPDATE products SET 'p_price' 'p_price' +0.9 WHERE p_code = 'ffc%, dde%, bgg%,

you will have to excuse my lack of mysql knowledge.

Any pointers will be greatly appreciated.

0

Hi,

You can do something similar to what I did below.

update products set p_price = p_price * 1.10 WHERE p_code LIKE 'ffc%' or p_code LIKE 'dcc%';
0

Hi,

You can do something similar to what I did below.

update products set p_price = p_price * 1.10 WHERE p_code LIKE 'ffc%' or p_code LIKE 'dcc%';

Thanks for the code... it worked a treat! Just what I needed.

Thanks
Kevin

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.