Query to return associated data and not what is searched for
I've written a query that is the equivalent of asking someone to go find a sock but to also return anything else they found along with it.
I have bookings, each of which have a one-to-many relationship with one to [n] data objects. While I'm asking the database to find one of those data objects, I actually need it to retrieve any other data objects it might find. Alas, it's not working that way and it's only returning what it's finding.
I've emboldened the part of the query which is the source of my angst.
I'm sure this is a very common problem, but I can't articulate the problem to even search for a solution!
As always, any advice would be warmly received.
DATE_FORMAT(bookings.creation_date, '%a %D %b %y') AS creation_date,
DATE_FORMAT(bookings.modification_date, '%a %D %b %y') AS modification_date,
DATE_FORMAT(bookings_attendees.stay_date, '%a %D %b %y') AS stay_date,
venues.venue_id AS venue_id,
venues.name AS venue,
MAX(bookings_history.modification_date) AS booking_history
(bookings_history.booking_id = bookings.booking_id)
), '%a %D %b %y, %H:%i') AS booking_history,
COALESCE(GROUP_CONCAT(DISTINCT bookings_clients_options_data.value SEPARATOR 0x1D), 'NULL') AS clients_options
(bookings.booking_id = bookings_attendees.booking_id)
(bookings.client_id = '3')
(bookings.status = 'confirmed')
(bookings.mode = 'public')
(bookings.booking_id = bookings_clients.booking_id)
(clients.client_id = bookings_clients.client_id)
(clients.client_id = '1')
(venues.venue_id = bookings.venue_id)
(bookings_clients_options.client_id = '3')
(bookings_clients_options.bookings_client_option_id = bookings_clients_options_data.bookings_client_option_id)
(bookings_clients_options_data.booking_attendee_id = bookings_attendees.booking_attendee_id)
(bookings_clients_options_data.bookings_client_option_id = '4')
GROUP BY bookings.booking_id
ORDER BY bookings_attendees.stay_date