Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- Date(r.return_at + interval '8' hour) as date,
- z.city as city,
- count(distinct r.id) as resv,
- count(distinct case when p.paid_type = 'card' then p.reservation_id end) as cardpaid,
- count(distinct case when p.paid_type = 'eWallet' then p.reservation_id end) as grabpay
- from reservations r
- join zones z on r.start_zone_id = z.id
- right join payments p on p.reservation_id = r.id
- join members m on r.member_id = m.id
- where r.return_at >= '2019-4-1'
- and r.state = 'completed'
- and z.city in ('KL','JB','PG','SL')
- and m.state = 'normal'
- and m.imaginary = 'normal'
- group by date,city
Advertisement
Add Comment
Please, Sign In to add comment