by using a case statement and the datediff function...
for the end date, it's similar logic... just change the 90-01 to 08-30 (I think you meant the end of august, not the end of September, otherwise you end up with an overlap.Code:case when getdate() < convert(datetime, convert(varchar(4), year(getdate()) + '-09-01') then convert(datetime, convert(varchar(4), (year(getdate())-1) + '-09-01') else convert(datetime, convert(varchar(4), year(getdate()) + '-09-01') end as startDate
-tg




Reply With Quote