title: Oracle query for get employee in and out time for generated query based on first in and lastout
body: <p>I wanted to get employee attendance based on in/our at my oracle database table column. The column name is Direction which have in/out value and time have at another column. 
  my problem is that I am getting in and out time more times for a employee sine they are are do in and out more than one times with their card pance system. I wanted to get only first in time for each employee and last out time for each employee. Here is my query for this </p>
  
  <pre><code>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 &gt;= 1568763700 and tstamp &lt; (select (sysdate - date '1970-01-01') * 86400000 from dual)
  order by fullname desc;
  </code></pre>
  
  <p>here is data for the query </p>
  
  <pre><code>fullname        Direction   Time
  --------        ---------   ----------
  
  Utpal Dhar      In          18-09-2019  08:02:00 AM
  Utpal Dhar      In          18-09-2019  08:04:31 AM
  Utpal Dhar      In          18-09-2019  08:04:35 AM
  TOPAZZAL HOSEN  In          19-09-2019  07:57:51 AM
  TOPAZZAL HOSEN  In          18-09-2019  07:56:39 AM
  TOPAZZAL HOSEN  out         18-09-2019  04:13:18 PM
  TOPAZZAL HOSEN  out         18-09-2019  12:36:23 PM
  </code></pre>
  
  <p>this query giving all in and out time for each employee, but I need only row which will first in time with in direction and last out time with last direction. </p>
  
  <p>Here is rows as I am expecting</p>
  
  <pre><code>fullname        Direction   Time
  --------        ---------   ----------
  
  Utpal Dhar      In          18-09-2019  08:02:00 AM
  TOPAZZAL HOSEN  In          18-09-2019  07:56:39 AM
  TOPAZZAL HOSEN  out         18-09-2019  04:13:18 PM
  </code></pre>
  
  <p>Please help me with this</p>