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
 
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 Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts How to replace the below query? pkmurali DB2 12 Tue Feb 27, 2018 9:51 pm
No new posts WRITE to VSAM giving duplicate RC picus_mf CICS 1 Fri Feb 23, 2018 2:52 pm
No new posts Need Guidance regarding UPDATE query Poha Eater DB2 3 Mon Feb 12, 2018 11:35 pm
No new posts Query to skip Max time-stamp and fetc... vickey_dw DB2 8 Sun Jan 28, 2018 1:09 am

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