ORDER BY column1 DESC, column2
This sorts everything by column1
(descending) first, and then by column2
(ascending, which is the default) whenever the column1
fields for two or more rows are equal.
More Related Contents:
- Sort by column ASC, but NULL values first?
- ORDER BY the IN value list
- SQL best practice to deal with default sort order
- How to order by with union in SQL?
- SQL Query – Using Order By in UNION
- Optimize query with OFFSET on large table
- When no ‘Order by’ is specified, what order does a query choose for your record set?
- How to use DISTINCT and ORDER BY in same SELECT statement?
- sql ORDER BY multiple values in specific order?
- SQL how to make null values come last when sorting ascending
- How to use Oracle ORDER BY and ROWNUM correctly?
- Sorting null values after all others, except special
- Can I do a max(count(*)) in SQL?
- How to update and order by using ms sql
- How to ORDER BY a SUM() in MySQL?
- SQL Server UNION – What is the default ORDER BY Behaviour
- Sort NULL values to the end of a table
- SQLite and custom order by
- Why do NULL values come first when ordering DESC in a PostgreSQL query?
- Alphanumeric sorting with PostgreSQL
- Sorting string column containing numbers in SQL?
- SQL ORDER BY date problem
- “Order By” using a parameter for the column name
- Custom Order in Oracle SQL
- SQL for ordering by number – 1,2,3,4 etc instead of 1,10,11,12
- SQLite Order By Date1530019888000
- how does SELECT TOP works when no order by is specified?
- How to get results in a custom order? [closed]
- SQL ORDER chars numerically
- Dynamic order direction