Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

minimum hiredate in emp table

675433Oct 23 2009 — edited Oct 23 2009
Hi,

There is an emp table, which a column hiredate(date). I want to get the record with minimum hiredate and using this query.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL> with t as
  2  (select 'A' ename, 1 enum, '1-Oct-2008' hiredate from dual union all
  3  select 'B', 2, '1-Jan-2002' from dual union all
  4  select 'C', 3, '1-Mar-2008' from dual)
  5  select * from t
  6  where hiredate = (select min(hiredate) from t);

E       ENUM HIREDATE
- ---------- ----------
B          2 1-Jan-2002

SQL> 
Is there any other way to do it, without using subquery?

Regards,
Ritesh
This post has been answered by Centinul on Oct 23 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 20 2009
Added on Oct 23 2009
3 comments
1,452 views