Combining ORDER BY and DISTINCT DISTINCTcombined with ORDER BY

Without a transformation, a statement that contains both DISTINCT and ORDER BY would require two separate sorting steps-one to satisfy DISTINCT and one to satisfy ORDER BY. (Currently, uses sorting to evaluate DISTINCT. There are, in theory, other ways to accomplish this.) In some situations, can transform the statement internally into one that contains only one of these keywords. The requirements are:

A unique index is not required.

For example: SELECT DISTINCT miles, meal FROM Flights ORDER BY meal

is transformed into SELECT DISTINCT miles, meal FROM FlightsNote that these are not equivalent functions; this is simply an internal transformation.