Question:
My SQL statement at the moment is: SELECT * FROM NewsItems
How do I sort the dates in descending order?
Answer:
Use the ORDER BY clause to sort the results of a SELECT statement. The ORDER BY clause orders the results by the specified column. It sorts in ascending order by default, so you’ll have to specify descending order like this:SELECT * FROM NewsItemsORDER BY DateCol DESC
The DESC applies only to the column preceding it so you could order by date in descending order and by another column in ascending order.SELECT * FROM NewsItemsORDER BY DateCol DESC, AnotherCol ASC