In UNION and GROUP BY queries, the column used for sorting has to be present in the output list. In other queries, non-output columns and (in v.1.5) expressions on non-output columns are valid ordering criteria.And it wouldn't explain his second try according to my suggestion to sort by PROGRAM_ID since this IS a output-column
And it wouldn't explain his second try according to my suggestion to sort by PROGRAM_ID since this IS a output-column.