Reputation: 35
I am looking for some help. I am not a developer or programmer, I am an owner of a webshop and I am looking for some help. In MySQL I have two rows like this:
id | row_X | Row_Y
------------------------
1 | 100 | 100
2 | 200 | 500
3 | 300 | 750
4 | 400 | 1000
5 | 500 | 1250
What I want is that in mySQL I can update so that if row_x is 1, row_y should be 1,5 -- there is a proportion of 1/1,5 always
How can I do this?
Thanks
Upvotes: 1
Views: 63
Reputation: 2201
If I understood you right, you want to set row_y to row_x * 1,5? To do so for all entries you could do something like that:
UPDATE `table` SET `row_y` = `row_x` * 1.5
See working fiddle here: http://sqlfiddle.com/#!9/f6c534/1
Upvotes: 5