Subject Order by (Date minus Date)
Author ai_no_kareshi
Greetings, all. Suppose I have a table of time periods which I want to
order by their length. I am trying to do something like the following,
which I know does not work:

SELECT P.PeriodName, (P.EndDate - P.StartDate) AS PeriodLength
FROM Periods P
ORDER BY 2 DESC

Is there any simple way to subtract dates in Firebird? I am not
interested in the format (seconds, hours, minutes), as long as the
records can be ordered by this value.