Sort Date in Descending Order

Sort Date in Descending Order

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

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved