DROP VIEW IF EXISTS noshow_per_event_schedule_view; CREATE VIEW noshow_per_event_schedule_view AS (SELECT ean.event_id, ean.event_schedule_id, evsched.no_show_stat, SUM(booking_expected) total_waiting, SUM(booking_expected) total_bookings, SUM(attendance) total_attendance, SUM(booking_expected-attendance) total_noshow FROM event_attendance_noshow ean INNER JOIN event_schedule evsched USING (event_schedule_id) GROUP BY event_schedule_id)