tags:

views:

36

answers:

1

hi! 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?

+2  A: 

Use:

SELECT t.id,
       t.start,
       t.end,
       t.start - t.end AS difference
  FROM TABLE t
ORDER BY difference DESC
OMG Ponies