Completed Tour Booking sql
This commit is contained in:
parent
78ebce3ba4
commit
98fd718ef5
3 changed files with 70 additions and 17 deletions
22
doc/booking_query_2_of_2.all_users_unbooked.sql
Normal file
22
doc/booking_query_2_of_2.all_users_unbooked.sql
Normal 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
|
||||
;
|
||||
Loading…
Add table
Add a link
Reference in a new issue