Today I come across with a complex sql query requirement where I have to filter a table on a column entry and then sort according to date. The SQL language have some inbuilt keywords like ORDER to sort out this type of issues.

Let use have below table for our practice purpose

For ascending order use below code
select * from table where column_name1='value1' order by table.column_name2 ASC

Example:

For descending order use below code
select * from table where column_name1='value1' order by table.column_name2 DESC

​Example:

 

The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.