ahmedrahil786

Information of Doc Rejectioo

Apr 30th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. Select
  2.  
  3. A.mid,
  4. B.docuploaddate,
  5. B.state,
  6. B.rejectcomment,
  7. B.DocUploaded,
  8. B.DocApproved
  9.  
  10. from
  11.  
  12. (select
  13. distinct(m.id) as mid
  14. from members m
  15. where m.imaginary = 'normal') A
  16.  
  17. left join
  18.  
  19. (select
  20. distinct dl.member_id as mid,
  21. date(dl.created_at + interval '8' hour) as docuploaddate,
  22. dl.state as state,
  23. dl.reject_category_id as dlrid,
  24. dlrc.name as rejectcomment,
  25. count(distinct dl.member_id) as DocUploaded,
  26. count(distinct case when dl.state = 'approved' then dl.member_id end) as DocApproved
  27.  
  28. from driver_licenses dl
  29.  
  30. left join driver_license_reject_categories dlrc
  31. on dl.reject_category_id = dlrc.id
  32.  
  33. group by 1) B
  34.  
  35. on A.mid = B.mid
Advertisement
Add Comment
Please, Sign In to add comment