Version 4 (modified by 30 hours ago) ( diff ) | ,
---|
Напредни извештаи од базата (SQL и складирани процедури)
Извештај за број на откжани, успешни резервации по ресторан
SELECT au.first_name, au.last_name, au.membership_level, au."role", rh.restaurant_id, COUNT(CASE WHEN rh.cancellation_reason = 'Canceled by user' THEN 1 END) AS canceled_by_user_per_restaurant, COUNT(CASE WHEN rh.cancellation_reason = '/' THEN 1 END) AS succesfull_by_user_per_restaurant, COUNT(CASE WHEN rh.cancellation_reason = 'Canceled by restaurant' THEN 1 END) AS canceled_by_restaurant, COUNT(rh.cancellation_reason) AS total_cancellations_per_restaurant FROM reservation_history rh INNER JOIN app_user au ON rh.customer_id = au.id WHERE rh.cancellation_reason IS NOT NULL GROUP BY au.first_name, au.last_name, au.membership_level, au."role", rh.restaurant_id ORDER BY canceled_by_user_per_restaurant DESC;}}}
Note:
See TracWiki
for help on using the wiki.