Here’s my table data:
id __ firstname __ lastname __ salary
_____________________________________
1 __ John __ Brown __ 2,1000
2 __ David __ Green __ 3,8000
3 __ Matt __ Blue __ 1,6000
You see, salary contains 2 values, which are separated by a comma.
I want to reverse salary value; so John salary should be 1000,2, David, 8000,3 and Matt 6000,1.
How to do it with a sql query?
How about this:
Here is a demonstration: http://sqlfiddle.com/#!2/d41d8/4473
Here’s the thing about this, the primary purpose of SQL is to store and retrieve data, not to transform or modify it. You should ideally use PHP to do this.