I just want to get the rows depending on where is the join. It is either HOSPEDAJE
joining HOTEL
, or HOSPEDAJE
joining APARTAMENTO
, but never at the same time.
I'm getting this error: #1241 - Operand should contain 1 column(s)
SELECT DISTINCT(Nombre,Ciudad,Provincia,Estrellas,Tipo,null,null)
FROM hospedaje, hotel, habitacion
WHERE
hotel.hospedaje_id = hospedaje.id
AND habitacion_id = habitacion.id
UNION
SELECT DISTINCT(Nombre,Ciudad,Provincia,null,null,Disponibles,Capacidad)
FROM hospedaje, apartamento
WHERE apartamento.hospedaje_id = hospedaje.id