hi, how can i change all values in a db's coloum, for example i wish to reduce all prices in my database by 20%
thanks
It might be something along the lines of:
UPDATE Products SET price=0.8 * price;
how could i do it with a percentage (%)? also how can i convert this to sql query?😕 thanks
Not sure if it can be done from SQL itself, but a simple solution is to use PHP to convert to n% to (100-n)/100
hi, got it to work with mysql though is it posslible to get mysql to round the sum to 2 decimal places. (9.99) instead of (9.998)
Yes, if you say use a DOUBLE(10,2) or NUMERIC(10,2) for the column data type. Alternatively you can use PHP's [man]round/man.
If you don't want to change the column type, you could always just tell MySQL to ROUND() the value off.