Changes between Version 7 and Version 8 of AdvancedDatabaseReports
- Timestamp:
- 12/20/22 12:38:27 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AdvancedDatabaseReports
v7 v8 20 20 21 21 {{{#!sql: 22 SELECT dr.driver_id, dr.email, (CASE WHEN num_grades > 2 THEN AVG(de.grade) ELSE NULL END) as driver_grade, COUNT(*) as number_of_drives,22 SELECT dr.driver_id, dr.email, c.make, c.model, (CASE WHEN num_grades > 2 THEN AVG(de.grade) ELSE NULL END) as driver_grade, COUNT(*) as number_of_drives, 23 23 SUM(p.total_sum_payed) as total_money_made, COUNT(DISTINCT de.request_id) as number_of_different_requests, 24 24 COUNT(DISTINCT r.passenger_id) as number_of_different_passengers, (SUM(p.total_sum_payed))/COUNT(DISTINCT de.request_id) as average_money_per_request, 25 SUM(d .km_travelled) as total_km_travelled25 SUM(de.km_travelled) as total_km_travelled 26 26 FROM 27 27 driver dr 28 LEFT JOIN car c ON dr.driver_id = c.driver_id 28 29 JOIN drive de ON dr.driver_id = de.driver_id 29 30 JOIN payment p ON de.drive_id = p.drive_id 30 31 LEFT JOIN request r ON de.request_id = r.request_id 31 GROUP BY dr.driver_id, dr.email 32 GROUP BY dr.driver_id, dr.email, c.make, c.model 32 33 ORDER BY driver_grade DESC 33 34 }}}