query between separate date fields
Posted on 2013-01-30
i need to query between two datetime columns. Start date is given and need to calculate 90 days out from that date.
declare @StartDate as date, @EndDate as date
set @StartDate = '1/14/2013'
set @EndDate = dateadd(d,90,@StartDate)
cast(StartTimeLocal as Date) >= @StartDate
and cast(EndTimeLocal as Date) <= @EndDate
problem is that i don't see all the rows. if i comment out: and cast(EndTimeLocal as Date) <= @EndDate I see the rows.
start date of 2013-01-14 06:00:00.000
end date of 2013-08-02 00:59:00.000
this row only shows when i comment out: and cast(EndTimeLocal as Date) <= @EndDate otherwise it doesn't show.
how do i find the rows between those dates?