Fix of tour_rooms query 1/2; TourController is still inoperable.

This commit is contained in:
Torsten 2022-05-10 09:31:53 +02:00
parent 9c04f88937
commit 78ebce3ba4
3 changed files with 271 additions and 34 deletions

View file

@ -2,22 +2,29 @@
SELECT
qry.tour_id,
qry.room_id,
b.user_id,
u.id,
u.name,
qry.capacity,
qry.room_name,
COALESCE(qry.room_name,'Ungebucht') room_name,
COALESCE(qry.room_name,'ZZZZZZZZZ') room_sort_order
FROM (
SELECT
tr.tour_id,
tr.id as room_id,
tr.capacity,
tr.name as room_name
FROM
tour_rooms tr
WHERE
FROM
(
SELECT
tr.tour_id,
tr.id as room_id,
tr.capacity,
tr.name as room_name,
b.user_id
FROM
tour_rooms tr
LEFT JOIN bookings as b
ON b.tour_id = tr.tour_id AND b.room_id = tr.id
WHERE
tr.tour_id= 17
) qry LEFT JOIN bookings as b
ON b.tour_id = qry.tour_id AND b.room_id=qry.room_id
ORDER BY 6,4
) qry
LEFT JOIN users as u
ON qry.user_id = u.id
ORDER BY
qry.room_id
;