Use the ORDER BY
clause to sort the records in your recordset. For example, suppose you want to sort the records in the recordset by customer earnings, from the lowest to the highest. In SQL, order the records as follows:
SELECT LastName, FirstName, Earnings FROM Customers ORDER BY Earnings
By default, the ORDER BY
clause sorts records in ascending order (1, 2, 3... or A, B, C...). If you want to sort them in descending order, from the highest earnings to the lowest, use the DESC
keyword as follows:
ORDER BY Earnings DESC