Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to get the details in descending order from the table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
shekhar.sumanin

New User


Joined: 18 Dec 2006
Posts: 1
Location: hyderabad

PostPosted: Mon Dec 18, 2006 8:52 pm    Post subject: How to get the details in descending order from the table
Reply with quote

Without changing the verb ascending to descending how to get the details in descending order from the table
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Dec 18, 2006 10:30 pm    Post subject:
Reply with quote

Other than reading all the data "Ascending" and storing it for a reversing sort or table lookup in reverse, I can't think of a way.

Why can't you change the verb?

Well you could add a column, load it with a reversed key and retrieve it with that index. Can a column be renamed? Drop the original key, rename it and new reversed key column and rebuild the original key to the backwards key, the program would never know what hit it....grin....
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Dec 21, 2006 3:36 am    Post subject: Re: How to get the details in descending order from the tabl
Reply with quote

Well,

If you had a table declared as:

DECLARE TABLE1 TABLE
(COL1 DEC(5),
COL2 DEC(11)
)

Any you want to order by COL1 DESC, but you cannot use ?DESC? you could:

Code:

SELECT COL1,
       COL2
  FROM DB2.TABLE1
 ORDER BY (99999 ? COL1)


Dave
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us