Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT ints, min(outts), min(st) FROM
- (
- SELECT b_ins.ts as ints,b_outs.ts as outts,b_outs.sub_type as st
- FROM punches b_ins join punches b_outs on
- to_days(b_ins.ts)=to_days(b_outs.ts) and
- b_ins.punch_type='BREAK' and
- b_ins.sub_type=b_outs.sub_type and
- b_outs.punch_type=b_ins.punch_type and
- b_ins.user_id=b_outs.user_id and
- b_outs.ts>b_ins.ts and
- b_ins.entry_type='START' and b_outs.entry_type='END'
- WHERE b_ins.user_id=5628 and
- to_days(b_ins.ts)=to_days('2008-10-09')
- ) as foorbar GROUP BY ints;
Add Comment
Please, Sign In to add comment