Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- weekofyear(r.return_at) as week, r.start_zone_id as zid2, count(r.id) as nuse,
- sum(timestampdiff(minute, r.start_at, r.return_at)/60) as dur,
- sum((timestampdiff(minute, r.start_at, r.end_at)/60)/24)*12 + if(mod((timestampdiff(minute, r.start_at, r.end_at)/60), 24)>=12,12,mod((timestampdiff(minute, r.start_at, r.end_at)/60), 24)) as adj_dur,
- sum(ifnull((select sum(amount) from charges where state='normal' and r.id=reservation_id and kind in ('rent','oneway','d2d','mileage')),0)) as rental,
- sum(ifnull((select sum(amount) from payments where state='normal' and reservation_id=r.id and paid_type ='coupon'),0)) as discount
- #count(distinct m.id) as mau
- from reservations r, members m , zones z
- where r.member_id=m.id
- and r.start_zone_id = z.id
- and r.way in ('round','d2d','oneway')
- and r.state = 'completed'
- and m.imaginary in ('normal', 'sofam')
- and r.return_at+interval 8 hour >= @start
- and r.start_zone_id not in (2,3,101,383,378,697,712,818)
- group by week, zid2
Advertisement
Add Comment
Please, Sign In to add comment