MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

retrieve the row which has lowest date

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
onesource
Beginner


Joined: 26 Jan 2011
Posts: 6
Topics: 3

PostPosted: Wed Feb 16, 2011 11:52 am    Post subject: retrieve the row which has lowest date Reply with quote

Hello,

I want to retrieve a row from table which contains lowest date OUT_DATE (format DATE).

Could any one pls help to write the query?

thanks in advance.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Feb 16, 2011 12:05 pm    Post subject: Reply with quote

onesource,

Unless I am missing something isn't it a simple task of using the FETCH FIRST?

Untested sql

Code:

SELECT DATE_COL           
  FROM TABLE
ORDER BY DATE_COL           
FETCH FIRST 1 ROW ONLY   
;     


Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
onesource
Beginner


Joined: 26 Jan 2011
Posts: 6
Topics: 3

PostPosted: Wed Feb 16, 2011 12:18 pm    Post subject: Reply with quote

Thanks a lot.
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Wed Feb 16, 2011 1:45 pm    Post subject: Reply with quote

Or even select min(date_col) . . . ?
_________________
All the best,

di
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group