Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 how to send just 10 rows in a CICS sc... Megha Gupta CICS 5 Thu Feb 23, 2017 6:57 pm
No new posts Join of more than one table dibyendumandal11111 DB2 6 Mon Feb 13, 2017 11:36 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us