Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. select * from (select emp_id,emp_name,profile_picture_url,
  2. sum(
  3. case
  4. when holiday = TRUE then 0
  5. when offday = TRUE then 0
  6. when on_leave = TRUE then 0
  7. else 1
  8. end
  9. ) as expected_days,
  10. sum(
  11. case
  12. when late = TRUE then 1
  13. else 0
  14. end
  15. ) as late_days
  16. from attendance_summary
  17. where office_id = 40
  18. and att_date_in_milliseconds between 1561831200000 and 1563472800000
  19. and present = true
  20. and include_in_att_report = true
  21. group by emp_id,emp_name,profile_picture_url
  22. ) as temp
  23. order by (Cast(late_days as float)/ Cast(nullif(expected_days,0) as float)) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement