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
 

 

Order by query is not giving the appropriate results

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

New User


Joined: 02 Nov 2006
Posts: 17

PostPosted: Sat Nov 11, 2006 3:07 pm    Post subject: Order by query is not giving the appropriate results
Reply with quote

The below query is not giving the appropriate results in my program.
Is order by with fetch first row valid.?


SELECT DATE_1,
DATE_2,
FROM TABLE001
WHERE ACCT_ID = '1'
AND ACCT_NBR = '13244'
AND SUR_NAME = (
SELECT FAC_NAME
FROM TABLE002
WHERE ACCT_ID = '0256'
)
ORDER BY DATE_3 DESC, TIME_3 DESC
FETCH FIRST ROW ONLY
Back to top
View user's profile Send private message

BuildersHeaven

New User


Joined: 17 Apr 2006
Posts: 2

PostPosted: Sun Nov 12, 2006 4:52 am    Post subject:
Reply with quote

Can you better explain what you should receive and what you receive now ?

You should also write the Unix key of tabe001 an table002 ... and , if necessary, the tables of every column.

check the join also.
icon_wink.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Sun Nov 12, 2006 5:15 am    Post subject: Re: Order by query is not giving the appropriate results
Reply with quote

adarsh,

Use ORDER BY at last after FETCH. Like this...

Code:
FETCH FIRST ROW ONLY
ORDER BY DATE_3 DESC, TIME_3 DESC
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Vision results (also known as DYL-280) CaptBill CA Products 1 Tue Dec 20, 2016 3:35 am


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