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 Weirdo results with JOINKEYS Balaryan DFSORT/ICETOOL 4 Wed Oct 18, 2017 9:04 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Sorting on text - but in non-alphabet... Roy Ware SYNCSORT 5 Wed Aug 23, 2017 9:15 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am

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