cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting in Queries

Former Member
0 Kudos

Hi,

I have a query on sales orders and I use the order by function to sort. I want it to sort some columns decending and other columns ascending. Is there a way to do this?

Thanks!

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member583013
Active Contributor
0 Kudos

Emily,

Seeing your query would give a better idea of what you are looking for. If possible paste the same here and then mentioned the columns and your requirement.

Suda

Former Member
0 Kudos

Hi Emily,

When you sort your query in combination, better to put all restriction on your sorting fields. For descending, add DESC. For ascending, add ASC. You can always omit the later since it is default. Putting it there can help you to be more clear.

Thanks,

Gordon

Former Member
0 Kudos

hi here is a sample for descending sorting :

SELECT TOP 1 T0.TrsfrRef FROM ORCT T0 ORDER BY T0.TransID DESC

ascending sort is default in SQL