I am struggling with a problem of giving a date range given the start
date.
Here is my example, I would need to get all the accounts opened between
each month end and the first 5 days of the next month. For example, in
the table created below, I would need accounts opened between
'5/31/2005' and '6/05/2005'. And my query is not working. Can anyone
help me out? Thanks a lot!
create table a
(person_id int
,account int
,open_date smalldatetime)
insert into a values(1,100001,'5/31/2005')
insert into a values(1,200001,'5/31/2005')
insert into a values(2,100002,'6/02/2005')
insert into a values(3,100003,'6/02/2005')
insert into a values(4,100004,'4/30/2004')
insert into a values(4,200002,'4/30/2004')
--my query--
Select *
From a
Where open_date between '5/31/2005' and ('5/31/2005'+5)