Just as an FYI, if you want to reassure yourself that the ORDER BY
is being applied as intended, you could do the following:
(
select 1 as hint, start_time as when [...]
union all
select 2 as hint, end_time as when [...]
) order by seq, when
This is ANSI/ISO standard, and works in PostgreSQL (based on
a quick test).
>>> "Merlin Moncure" <merlin.moncure@rcsonline.com> >>>
hmm, try pushing the union into a subquery...this is better style
because it's kind of ambiguous if the ordering will apply before/after
the union.
select q.when from
(
select 1 as hint, start_time as when [...]
union all
select 2 as hint, end_time as when [...]
) q order by q.seq, when