Records can be sorted based on multiple columns values too, to do that separate the column name by comma (“,”) followed by ASC or DESC keywords.
SELECT PersonalDetailsId, FirstName, LastName, Age, Active FROM PersonalDetails ORDER BY Age,
Above query will give the sorted records based on Age (in ascending order as if not specified, ASC is treated by default) and then based on Active column values.
Sorting can be done on any type of data (string, integer, double, date etc.) columns, its SQL Server responsibility to sort the record based on data type’s values and give us the correct result.
Views: 3639 | Post Order: 47