Completed Tour Booking sql

This commit is contained in:
Torsten 2022-05-11 07:51:47 +02:00
parent 78ebce3ba4
commit 98fd718ef5
3 changed files with 70 additions and 17 deletions

View file

@ -0,0 +1,22 @@
-- Display all booked users (regardless of booked room)
-- restrict to unbooked users
SELECT
b.tour_id,
b.room_id,
b.user_id,
u.name as user_name,
tr.capacity,
COALESCE(tr.name,'Ungebucht') as room_name,
COALESCE(tr.name,'ZZZZZZZZZ') as room_sort_order
FROM
users u,
bookings b
LEFT JOIN tour_rooms as tr
ON b.room_id = tr.id
WHERE
b.tour_id= 17
AND
b.user_id = u.id
AND
capacity is null
;