ahmedrahil786

Incr_ DL Approval Rate Project _ Rahil - Nash - CSR Project

Aug 26th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. # no of members by reject reason /* */
  2.  
  3. set @start := '2019-1-1';
  4. Select A.date, A.week, B.DocUploaded, A.total, A.sf_cov_bydoc, A.sf_wo_face, A.sf_wo_doc, A.dl_no_doc, A.dl_doc_blur,A.dl_expired,A.pdl,A.jpj_blacklist,A.dl_unmatched, A.pic_crop, A.under_21,
  5. A.fake_id, A.etc,A.duplicate_IC,A.IC_in_selfie_blur, A.passport_blur,A.unrelated from
  6.  
  7. (select
  8. date(dl.created_at + interval 8 hour) as date,
  9. weekofyear(dl.created_at + interval 8 hour) as week,
  10. count(dl.id) as total,
  11. count(if(rc.id=1, dl.id, null)) as sf_cov_bydoc,
  12. count(if(rc.id=2, dl.id, null)) as sf_wo_face,
  13. count(if(rc.id=3, dl.id, null)) as sf_wo_doc,
  14. count(if(rc.id=4, dl.id, null)) as dl_no_doc,
  15. count(if(rc.id=5, dl.id, null)) as dl_doc_blur,
  16. count(if(rc.id=6, dl.id, null)) as dl_expired,
  17. count(if(rc.id=7, dl.id, null)) as pdl,
  18. count(if(rc.id=8, dl.id, null)) as jpj_blacklist,
  19. count(if(rc.id=9, dl.id, null)) as dl_unmatched,
  20. count(if(rc.id=10, dl.id, null)) as pic_crop,
  21. count(if(rc.id=11, dl.id, null)) as under_21,
  22. count(if(rc.id=12, dl.id, null)) as fake_id,
  23. count(if(rc.id=13, dl.id, null)) as etc,
  24. count(if(rc.id=14, dl.id, null)) as duplicate_IC,
  25. count(if(rc.id=15, dl.id, null)) as IC_in_selfie_blur,
  26. count(if(rc.id=16, dl.id, null)) as passport_blur,
  27. count(if(rc.id=17, dl.id, null)) as unrelated
  28. from members m, driver_licenses dl, driver_license_reject_categories rc
  29. where
  30. m.id = dl.member_id
  31. and m.imaginary in ('sofam', 'normal')
  32. and dl.state = 'reject'
  33. and dl.reject_category_id = rc.id
  34. group by date
  35. order by date desc) A
  36. left join
  37. (select
  38. Date(dl.created_at + interval '8' hour) as Date,
  39. weekofyear(dl.created_at + interval 8 hour) as week,
  40. count(distinct case when dl.state not in ('noInput','null') then dl.member_id end) DocUploaded
  41. from driver_licenses dl
  42. join members m
  43. on m.id = dl.member_id
  44. where m.imaginary = 'normal'
  45. group by 1) B
  46. on A.date = B.date
  47. where A.date >= @start
  48. ;
  49.  
  50. # all members and reject reason /* */
  51.  
  52. select distinct dl.member_id , dl.reject_category_id , dlc.name , Date(dl.created_at + interval 8 hour) as date
  53. from driver_licenses dl left join driver_license_reject_categories dlc on dlc.id = dl.reject_category_id
  54. where dl.state = 'reject'
  55. and Date(dl.created_at + interval 8 hour) = date_sub(curdate() , interval 1 day)
  56. order by dl.member_id desc ;
  57.  
  58. # Members with blur Reason /* */
  59.  
  60. select distinct dl.member_id , dl.reject_category_id , dlc.name , Date(dl.created_at + interval 8 hour) as date
  61. from driver_licenses dl left join driver_license_reject_categories dlc on dlc.id = dl.reject_category_id
  62. where dl.state = 'reject'
  63. and dl.state not in ('approved')
  64. and dl.reject_category_id in ('5','15','16')
  65. and Date(dl.created_at + interval 8 hour) >= '1-8-2019'
  66. order by dl.member_id desc ;
Advertisement
Add Comment
Please, Sign In to add comment