Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Complex PL-SQL Query ?
Fred,
You didn't specify your version of Oracle.
Here's a simple query that should work in most versions. (I'm assuming that ASOFDATE is of DATE data type).
select * from cimshist
where asofdate = (select max(asofdate) from cimshist)
hth
Martin Doherty
Fred Zimmerman wrote:
>I have a table CIMSHIST that has fields: hullno, hulltype, location, asofdate.
>
>I can have some data like the following
>
>HULLTYPE HULLNO LOCATION ASOFDATE
>-------- ------ -------- --------
>YOS 33 700012/S 13-APR-95
>YOS 33 700012/S 05-MAY-99
>YOS 33 700012/S 10-JUL-02
>
>
>I only want to return the record with
>latest ASOFDATE.
>
>Can anyone give me the SQL query to handle
>this task?
>
>
Received on Tue Nov 19 2002 - 15:40:10 CST
![]() |
![]() |