MySQL - Problema consulta Fechas habitaciones

 
Vista:
sin imagen de perfil

Problema consulta Fechas habitaciones

Publicado por Armando (1 intervención) el 18/12/2015 19:23:46
Ante todo un cordial saludo a todos.
Tengo la siguiente consulta de mysql:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
SELECT
    tbl_fechas_habitaciones.idFecha_Habitacion,
    tbl_fechas_habitaciones.refHabitacion,
    tbl_fechas_habitaciones.fechas,
    tbl_hotel.strNombre,
    tbl_hotel.intCategoria,
    tbl_habitaciones_hotel.refTipo_Habitacion,
    tbl_habitaciones_hotel.refImagenes,
    tbl_habitaciones_hotel.intEstado,
    tbl_habitaciones_hotel.intNumero_Habitacion,
    tbl_habitaciones_hotel.refHotel,
    tbl_habitaciones_hotel.id_Habitacion,
    tbl_hotel.idHotel,
    tbl_habitaciones_hotel.refUsuario,
    tbl_habitaciones_hotel.intPrecio_Especial,
    tbl_habitaciones_hotel.intPrecio_Alta,
    tbl_habitaciones_hotel.intPrecio_Media,
    tbl_habitaciones_hotel.intPrecio_Baja,
    tbl_habitaciones_hotel.strDescuento,
    tbl_habitaciones_hotel.intDescuento_Estado,
    tbl_habitaciones_hotel.intPromocion,
    tbl_habitaciones_hotel.strPromocion_Contenido,
    tbl_habitaciones_hotel.strDescripcion,
    tbl_habitaciones_hotel.intAdultos,
    tbl_habitaciones_hotel.intNinos,
    tbl_habitaciones_hotel.intBebes,
    tbl_hotel.intEstado,
    tbl_hotel.dblLatitud,
    tbl_hotel.dblLongitud,
    tbl_hotel.idProvincia,
    tbl_hotel.strPoblacion,
    tbl_hotel.strResumen,
    tbl_hotel.intNumero_Habitaciones,
    tbl_hotel.strEmail,
    tbl_hotel.strTelefono
    FROM tbl_fechas_habitaciones
    INNER JOIN tbl_habitaciones_hotel ON tbl_fechas_habitaciones.refHabitacion = tbl_habitaciones_hotel.id_Habitacion
    INNER JOIN tbl_hotel ON tbl_habitaciones_hotel.refHotel = tbl_hotel.idHotel
    WHERE tbl_fechas_habitaciones.fechas BETWEEN '2015-12-18' AND '2015-12-28'
    AND tbl_hotel.intEstado = 1 AND tbl_habitaciones_hotel.intEstado = 1
    AND tbl_hotel.idProvincia = 43
    GROUP BY tbl_fechas_habitaciones.refHabitacion
Que me arroja este resultado:
refHabitacion Fecha
2 2015-12-18

En la tabla correspondiente hay 3 Habitaciones la habitación id 2 tiene reservados desde 2015-12-18 hasta 2015-12-31
Las habitaciones id 1 y id 3 no tienen reservados esos días, los tiene libres.

Como podría hacer para que en la consulta anterior me saliera este resultado:
refHabitacion Fecha
1 2015-12-18
3 2015-12-18

Muchas gracias de antemano, un saludo: Manyblue
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder