Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Select A.* from
- (select
- distinct dl.member_id as mid,
- YEAR(dl.created_at) - YEAR(m.birthday) as age,
- IFNULL(dl.reject_category_id,"") as reject_id,
- IFNULL(dlc.name,"") as category_name,
- Date(dl.created_at + interval 8 hour) as date
- from driver_licenses dl left join driver_license_reject_categories dlc on dlc.id = dl.reject_category_id
- left join members m on m.id = dl.member_id
- where m.imaginary in ('sofam', 'normal')
- and YEAR(dl.created_at) - YEAR(m.birthday) < 100
- group by 1
- order by 1 desc) A
- Where A.date >= now() - interval 3 month
- order by 5 desc;
Advertisement
Add Comment
Please, Sign In to add comment