Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select distinct r.member_id as mid,
- ma.country as country,
- if(ma.country = 'MYS','local','international') as region
- from reservations r
- left join members m on m.id = r.member_id
- left join member_appendixes ma on ma.member_id = m.id
- where m.imaginary in ('sofam', 'normal')
- and r.member_id not in ('125', '127')
- #and ma.country not like 'MYS'
- group by 1 ;
- select
- ROUND(count(distinct case when A.region = 'international' then A.mid end)*100/count(distinct A.mid),2) as international_PCT,
- ROUND(count(distinct case when A.region = 'local' then A.mid end)*100/count(distinct A.mid),2) as local_PCT
- from
- (select distinct r.member_id as mid,
- ma.country as country,
- if(ma.country = 'MYS','local','international') as region
- from reservations r
- left join members m on m.id = r.member_id
- left join member_appendixes ma on ma.member_id = m.id
- where m.imaginary in ('sofam', 'normal')
- and r.member_id not in ('125', '127')
- #and ma.country not like 'MYS'
- group by 1) A
Add Comment
Please, Sign In to add comment