|
|
Question : Find items from a date and date span that fall between two dates
|
|
I have a table that contains the following items:
sDate - which is a date for the start of the record cList - which is the length of days the record applies to
I want to find all items that fall between two other specified dates.
groupID sDate cList 3 11/28/06 7 7 12/6/06 5 10 12/17/06 8
If I search for items between 12/1/06 and 12/20/06 it would return all three records. Add to that the number of days for each record that fall between the two dates.
|
Answer : Find items from a date and date span that fall between two dates
|
|
select * from yourtable where sDate <= '2006/12/20' and dateadd(day, cList, sDate) >= '2006/12/01'
|
|
|
|