Puse la consulta como me dijiste:
Código SQL
[-]
Select H.NroHabitacion,H.IdTipo,H.idHabitacion
From Habitaciones H
Where H.IdTipo = :tipo
and (H.IdHabitacion not in (Select R.IdHabitacion
From ClienteReservaHabitacion R
Where R.FechaSalida <= :desdefecha
or R.FechaIngreso >= :hastafecha)
or H.IdHabitacion not in (Select O.IdHabitacion
From ClienteOcupaHabitacion O
Where O.FechaSalida <= :desdefecha
or O.FechaIngreso >= :hastafecha)
)
Order By H.NroHabitacion
Y sigue sin andar, no me devuelve nada.... Nose donde ppuede estar el problema, porque probe las subconsultas por separado, y todas andan, ahora bien cuando las junto no me devuelve nada :/ Te mando como les paso los parametros:
Código Delphi
[-]
dm.ConNuevaReserva.Close;
dm.ConNuevaReserva.Parameters.ParamByName('tipo').Value :=
DBLookupComboBox1.KeyValue;
dm.ConNuevaReserva.Parameters.ParamByName('desdefecha').Value :=
DateTimePicker1.Date;
dm.ConNuevaReserva.Parameters.ParamByName('hastafecha').Value :=
DateTimePicker2.Date;