ahmedrahil786

Weekday Vs Weekend - One Way - Becca and Rahil

Jul 2nd, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. select * from
  2.  
  3. (select
  4. r.id,
  5. Date(r.return_at + interval '8' hour) as date,
  6. if(weekday(r.return_at + interval '8' hour) = '6' or weekday(r.return_at + interval '8' hour) = '0' ,'Weekend' , 'weekday') as weekday_Weekend,
  7. r.start_zone_id as zoneid
  8. from reservations r
  9. join members m
  10. on r.member_id = m.id
  11. where r.return_at + interval '8' hour >= curdate() - interval 180 day
  12. and r.state = 'completed'
  13. and r.way = 'oneway'
  14. and r.end_zone_id in ('244','245')
  15. and m.state = 'normal'
  16. and m.imaginary = 'normal'
  17. group by r.id) A
Advertisement
Add Comment
Please, Sign In to add comment