ahmedrahil786

Total Ride length (in hrs) for a certain time Period

Mar 14th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. select
  2.  
  3. sum(TIMESTAMPDIFF(hour,CONVERT_TZ(r.start_at, '+00:00', '+8:00'),CONVERT_TZ(r.end_at, '+00:00', '+8:00'))) as ridelength
  4.  
  5. from reservations r
  6.  
  7. where CONVERT_TZ(r.start_at, '+00:00', '+8:00') >= '2019-1-1 00:00'
  8. and CONVERT_TZ(r.start_at, '+00:00', '+8:00') <= '2019-1-31 00:00'
  9. and r.state = 'completed'
Advertisement
Add Comment
Please, Sign In to add comment