Guest User

Untitled

a guest
May 24th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. SELECT ints, min(outts), min(st) FROM
  2.  
  3. (
  4.  
  5. SELECT b_ins.ts as ints,b_outs.ts as outts,b_outs.sub_type as st
  6. FROM punches b_ins join punches b_outs on
  7. to_days(b_ins.ts)=to_days(b_outs.ts) and
  8. b_ins.punch_type='BREAK' and
  9. b_ins.sub_type=b_outs.sub_type and
  10. b_outs.punch_type=b_ins.punch_type and
  11. b_ins.user_id=b_outs.user_id and
  12. b_outs.ts>b_ins.ts and
  13. b_ins.entry_type='START' and b_outs.entry_type='END'
  14. WHERE b_ins.user_id=5628 and
  15. to_days(b_ins.ts)=to_days('2008-10-09')
  16.  
  17. ) as foorbar GROUP BY ints;
Add Comment
Please, Sign In to add comment