|
Why not use timestamp arithmetic and an embedded query?
with tbl as (select emp, timestamp(tim || ' ' || dte) as clocktime
from timecard A) tbl
, ins as (select * from tbl where punch='IN')
, outs as (select * from tbl where punch='OUT')
select outs.emp, outs.clocktime as outtime,
(select min(ins.clocktime) from ins where ins.emp = out.emp and ins.clocktime > outs.clocktime) as intime
from outs
I'm not sure about the arguments in that timestamp function, but the rest should work.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.