So for the query it looks like there's a one to many relationship between Hotel Bookings and Guests, meaning each hotel booking can have one or more guests. What happens if there's more than two guests for a booking?
EDIT:
You really can't produce a comma delimited list from a single SQL query when you don't know how many names can be related to a booking. That's more of a report program task.
EDIT:
However you can produce a list of names for each Bookings by grouping by Hotel and Bookings.
Select h.name, b.id, g.Fname, g,Lname
from hotel h, Hotelbooking b, guests g, GuestLink as GL,
where h.id = b.hotelid
and b.id = gl.hotelbookingid
and gl.guestid = g.id
group by h.name, b.id
[This message was edited by bigterp on February 05, 2002 at 11:24.]
EDIT:
You really can't produce a comma delimited list from a single SQL query when you don't know how many names can be related to a booking. That's more of a report program task.
EDIT:
However you can produce a list of names for each Bookings by grouping by Hotel and Bookings.
Select h.name, b.id, g.Fname, g,Lname
from hotel h, Hotelbooking b, guests g, GuestLink as GL,
where h.id = b.hotelid
and b.id = gl.hotelbookingid
and gl.guestid = g.id
group by h.name, b.id
[This message was edited by bigterp on February 05, 2002 at 11:24.]