View previous topic :: View next topic
|
Author |
Message |
John Poulakos
Active User
Joined: 13 Jun 2012 Posts: 178 Location: United States
|
|
|
|
I'm just verifying this, does:
ORDER BY 1 DESC, 2
mean the first value is descending and the second is a ascending? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
what does the manual say about it ??? |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
The ORDER BY clause allows you to sort the rows in your result set. Consider this
Code: |
SELECT columns
FROM tables
WHERE predicates
ORDER BY column ASC/DESC |
as I've stated earlier, the ORDER BY clause sorts the result set based on the columns specified. If the ASC or DESC value is omitted, it is sorted by ASC or ASC is default.
You can also sort by position in the SELECT List, as you did.
Keeping above in mind -- your assumption sounds correct, however, I've not verifed it (I leave RTFM for you, as Enrico suggests). |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Good question John - because this is so hard to test. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you find something n the documentation that is not clear, post what you found and your doubt.
Someone here will be able to clarify.
There is a link to "IBM Manuals" at the top of the page.
Our intent is for the user to learn (both the info and where to find it) not for us to provide a manual reading service . . . |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Hi All,
I just tried out this and I found it like as soon as it encounters either'ASC' or 'DESC' it does sorting and whatever you specified after ',' it will be in
ASC order.
So in your case order by 1 desc will be in place and '2' will be in asc order for every same value of 1. |
|
Back to top |
|
|
|