ahmedrahil786

Intercity Bookings- Rahil and Shiva

Apr 1st, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1.  
  2. set @startdate1 = '2017-03-01';
  3. set @startdate2 = '2020-05-01';
  4. use socar_malaysia;
  5. select date_format(convert_tz(r.return_at, '+00:00', '+8:00'),'%Y-%m-%d') as date,
  6. count(if(r.way in('oneway','onewayReturn' ), r.id, null)) as res_oneway_Intercity
  7.  
  8. from reservations r, zones z, members m, reservation_appendixes ra
  9.  
  10. Where
  11. r.start_zone_id = z.id
  12. and r.member_id = m.id
  13. and r.id = ra.reservation_id
  14. and m.imaginary in ('sofam', 'normal')
  15. and r.member_id not in ('125', '127')
  16. and z.id not in (2, 3, 101)
  17. and r.start_zone_id in (391, 966, 28, 941, 1312, 7, 740, 89, 126, 954, 1281, 849, 822, 1068, 792, 1165, 471)
  18. and r.end_zone_id not in (244, 245)
  19. and r.state in ('completed')
  20. and r.return_at + interval 8 hour >= @startdate1
  21. and r.return_at + interval 8 hour <= @startdate2
  22.  
  23. group by date
  24. order by date desc
Advertisement
Add Comment
Please, Sign In to add comment