In a mysql table I have, I want to select all the rows and all the columns, but by ordering them by the difference between the values of two values of the same column. Is there a way to write such an SQL query? Thank you very much!
Asked
Active
Viewed 175 times
1 Answers
0
SELECT * FROM MyTable ORDER BY (ColumnA - ColumnB)

Dylan Smith
- 22,069
- 2
- 47
- 62
-
-
i hope this will helps you, http://stackoverflow.com/questions/634568/how-to-get-difference-between-two-rows-for-a-column-field – Nagarajan Nov 24 '11 at 06:28