Sort by the sum of two columns in an SQL Table
Posted on 2007-11-27
SELECT trip_no,c_pilot_no AS PILOT,flight_hrs,flight_hrs_wait AS WAIT_HRS,flight_hrs + flight_hrs_wait AS TOTAL
ORDER BY c_pilot_no ASC
ORDER BY flight_hrs + flight_hrs_wait DESC;
The last line of code, the ORDER BY, is not working like I thought it would. I need this select query to be ordered by the TOTAL column as created above. It lists out correctly, but I cannot get the query to be sorted in order by the TOTAL column.