Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Select
- A.mid,
- B.docuploaddate,
- B.state,
- B.rejectcomment,
- B.DocUploaded,
- B.DocApproved
- from
- (select
- distinct(m.id) as mid
- from members m
- where m.imaginary = 'normal') A
- left join
- (select
- distinct dl.member_id as mid,
- date(dl.created_at + interval '8' hour) as docuploaddate,
- dl.state as state,
- dl.reject_category_id as dlrid,
- dlrc.name as rejectcomment,
- count(distinct dl.member_id) as DocUploaded,
- count(distinct case when dl.state = 'approved' then dl.member_id end) as DocApproved
- from driver_licenses dl
- left join driver_license_reject_categories dlrc
- on dl.reject_category_id = dlrc.id
- group by 1) B
- on A.mid = B.mid
Advertisement
Add Comment
Please, Sign In to add comment