I have a table with these fields
We want to bring the id's of cars that are available in a range of dates that I receive from two inputs that would be when they want to take the car and when they want to return it. This dates I compare with the columns DateOutDay and DateTimeRegress.
select idAuto from contratos
where (CAST(fechaHoraRegreso AS DATE) < '2017-09-11')
and ((CAST(fechaHoraSalida AS DATE) > '2017-09-12') or (CAST(fechaHoraSalida
AS DATE) < '2017-09-12'))
)
The problem is that there are dates that are not in the range and does not show them