Advertisement
Guest User

Untitled

a guest
Aug 26th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.48 KB | None | 0 0
  1. SELECT
  2. dd.driver_uuid, count(t.uuid) as trip_no, sum(t.original_fare_local) as trip_fare, -sum(commission_local) as commission, sum(toll_amount_local) as toll, sum(t.original_fare_local) - sum(toll_amount_local) as commisionable_fare
  3.  
  4. FROM dim_driver dd JOIN fact_trip t on dd.driver_uuid = t.driver_uuid and t.status = 'completed'
  5.  
  6. WHERE (dd.signup_city_id = 143 or dd.flow_city_id = 143) and t.begintrip_timestamp_local between '2016-8-15 04:00:00' and '2016-8-22 03:59:59'
  7.  
  8. GROUP BY 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement