This discussion is archived
4 Replies Latest reply: Apr 1, 2013 5:39 AM by jeneesh RSS

how to select last 3 records from a table?

875255 Newbie
Currently Being Moderated
I have a table named HRM_ATTENDANCE
as follows
Name         Type         Nullable Default Comments 
------------ ------------ -------- ------- -------- 
LEAVEDATE    DATE                                   
EMPLOYEECODE VARCHAR2(8)                            
LEAVETYPE    VARCHAR2(4)                            
APPROVEDBY   VARCHAR2(8)  Y                         
FEEDBY       VARCHAR2(8)  Y                         
FEEDTIME     DATE         Y                         
REMARKS      VARCHAR2(50) Y 
the table contains the leave record of employees as follows
LEAVEDATE   EMPLOYEECODE LEAVETYPE APPROVEDBY FEEDBY   FEEDTIME    REMARKS
----------- ------------ --------- ---------- -------- ----------- --------------------------------------------------
6/1/2013    00001        CL  
6/3/2013    00001        EL                                         
6/5/2013    00001        CPL    
6/7/2013    00001        SL 
6/9/2013    00001        CL                                        
I want to select the last 3 leaves(records) of employeecode '00001' while i dont know the what are the leave dates. in easy words i want to select the record where leavedate>='05-jun-2013' but i dont know any of the dates.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points