我只想根据连接的位置获取行。它可以是HOSPEDAJE
加入HOTEL
或HOSPEDAJE
加入APARTAMENTO
,但从来没有在同一时间。无法构建该查询
我得到这个错误:#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
可能重复的[MySQL错误1241:操作数应包含1列(S)](http://stackoverflow.com/问题/ 15820288/mysql-error-1241-operand-should-contain-1-columns) – showdev