Give me a list of drivers with a day on day decrease in completed rides, i.e drivers whose total number of completed rides ytd is less than the number of completed rides the day before
Anónimo
Construct two temp tables, each with two columns(driver id and completed ride). 1st table completed rides is for the previous day and 2nd table is for the day before. Use GROUP BY and COUNT on booking table. JOIN these two tables to form a table with four columns. (driver id, number of previous completed rides, driver id, number of completed rides the day before). Compare the completed rides before the JOIN using ON or WHERE clause