order by in sql after subtracting column values
i've a sql table with 3 columns: id, start, end
i've to select all(SELECT *) the results and arrange them descending from the (start-end) value..
can i do that in a single sql command? any开发者_运维技巧 help?
Use:
SELECT t.id,
t.start,
t.end,
t.start - t.end AS difference
FROM TABLE t
ORDER BY difference DESC
精彩评论