简体   繁体   中英

MySQL - How do I to select data from a table, ordering by the difference between the values of two columns?

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!

SELECT * FROM MyTable ORDER BY (ColumnA - ColumnB)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM