Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- weekofyear(r.return_at + interval '8' hour) as week,
- r.start_zone_id as zid,
- count(distinct case when r.state NOT IN ('canceled', 'fail') then r.member_id end) as ActiveMembers,
- count(distinct case when r.state NOT IN ('canceled', 'fail') then r.id end) as resv
- from reservations r
- join members m
- on m.id = r.member_id and m.email not like '%socar.my%' and m.imaginary = 'normal'
- where r.return_at + interval '8' hour >= @start
- group by 1,2
- order by 1 asc
Advertisement
Add Comment
Please, Sign In to add comment