Hello everyone I have wrote a query which will give me employee in and out time for a range of time, as my tables have many in and out time I wanted to get only last in or out time based on timestamp here is query for this
select
fullname,direction,to_char(((TO_DATE('19700101','yyyymmdd') + (tstamp/24/60/60) + 6/24)), 'dd-mm-yyyy hh12:mi:ss PM') as Time,
gate,lane,employment.employeeid,NATIONALID,departmentname,designation.designationname
from eofficeuat.entrylog_cpa
join eofficeuat.employee on entrylog_cpa.hrrecordid=employee.hrrecordid
join eofficeuat.employment on employee.hrrecordid=employment.hrrecordid
join eofficeuat.designation on employment.designationid=designation.designationid
join eofficeuat.department on employment.departmentid=department.departmentid
where department.departmentname = 'SECURITY'
and tstamp >= 1568764800 and tstamp < (select (sysdate - date '1970-01-01') * 86400000 from dual)
/*and tstamp in (select max(tstamp) from eofficeuat.entrylog_cpa)*/
/*and rownum >= (select count(tstamp) from eofficeuat.entrylog_cpa)*/
and fullname='A.K.M.TOWHID SARKER'
order by fullname asc;
this query give this result
full name direction time
--------- --------- ----
A.K.M.TOWHID SARKER out 18-09-2019 01:41:35 PM
A.K.M.TOWHID SARKER out 18-09-2019 01:29:08 PM
but I only want last row from this result. can you please help how can i do this?