Prady
Prady

Reputation: 11310

Order by in SQL

Is it possible to order a query result based on 2 columns with the first sorting ascending on column1 and the secondary sort on column2 in desc?

select * from table1 orderby column1, column2

I believe this SQL statement should work, would adding desc along with the second column work or is there any better way of doing it?

Upvotes: 4

Views: 320

Answers (1)

Johnno Nolan
Johnno Nolan

Reputation: 29659

yes

select * from table1 orderby column1 asc , column2 desc

Upvotes: 11

Related Questions