Subject | Need SQL help for finding non-existant records |
---|---|
Author | Clay Shannon |
Post date | 2005-06-23T21:54:14Z |
I know that sounds anti-logical/non-sensical, but here goes:
I need to see who either punched in late or punched out early:
select h.fullname, s.shiftdate, p.pchin, p.pchout, s.shift_begin,
s.shift_end
from scheduled_work s
join pchup p on p.empno = s.empno
join empinfo_history h on h.empno = s.empno
where (cast(p.pchin as date) = s.shiftdate) and
((cast(p.pchin as time) > s.shift_begin) or
(cast(p.pchout as time) < s.shift_end))
order by s.shiftdate
but also need to see which records exist in scheduled_work which do not have
corresponding records in pchup-in other words, the person did not punch in
or out at all (did not show up for work on a day they were schedule to
work).
How to do?
Clay Shannon,
Dimension 4 Software
[Non-text portions of this message have been removed]
I need to see who either punched in late or punched out early:
select h.fullname, s.shiftdate, p.pchin, p.pchout, s.shift_begin,
s.shift_end
from scheduled_work s
join pchup p on p.empno = s.empno
join empinfo_history h on h.empno = s.empno
where (cast(p.pchin as date) = s.shiftdate) and
((cast(p.pchin as time) > s.shift_begin) or
(cast(p.pchout as time) < s.shift_end))
order by s.shiftdate
but also need to see which records exist in scheduled_work which do not have
corresponding records in pchup-in other words, the person did not punch in
or out at all (did not show up for work on a day they were schedule to
work).
How to do?
Clay Shannon,
Dimension 4 Software
[Non-text portions of this message have been removed]