Using the Employees Table, below is an example to return the Id, FName and LName columns in (ascending) LName order:
SELECT Id, FName, LName FROM Employees
ORDER BY LName
Returns:
Id | FName | LName |
---|---|---|
2 | John | Johnson |
1 | James | Smith |
4 | Johnathon | Smith |
3 | Michael | Williams |
To sort in descending order add the DESC keyword after the field parameter, e.g. the same query in LName descending order is:
SELECT Id, FName, LName FROM Employees
ORDER BY LName DESC