Use Both Order by Asc and Desc in Single SQL Server Query

We have use many times order by desc and order by asc with different queries. we also used many times order by on two or more then two columns.

Example

select * from mytable order by column1,column2 desc

 

Here i am showing a example of both in a single query on different columns.

 

select * from mytable order by column1 asc , column2.

Example

select * from tbl_Employee order by lastName asc, Salary desc

 

Here the lastname column is first sorted and after that salary shorted as per condition

Ebook Download
View all
SQL Jobs
Read by 0 people
Download Now!
Learn
View all