Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to get latest date

Re: How to get latest date

From: Connor McDonald <mcdonald.connor.cs_at_bhp.com.au>
Date: Mon, 18 Jan 1999 09:45:22 +0800
Message-ID: <36A29232.2F34@bhp.com.au>


Adrian Harrison wrote:
>
> This is probably a very simple question but I can't work out how to do it!
>
> I have to write a sql statement that returns just one record from a table based on a date field
>
> I need to be able to pick the latest/earliest date!
>
> e.g
>
> 15-Jan-99
> 31-Jan-99
> 01-Jan-99
>
> How can I just return 31-Jan-99 or 01-Jan-99?
>
> Thanks
>
> Adrian harrison

If the date column is indexed you could get some performance benefits using a hint:

select /*+ INDEX_ASC(tname iname) */ datecol from tname
where rownum = 1

and ditto for INDEX_DESC
--



Connor McDonald
BHP Information Technology
Perth, Western Australia
"The difference between me and a madman is that I am not mad" Received on Sun Jan 17 1999 - 19:45:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US