So.... reformating and removing some of the extra parens I get this:WHERE DATEPART(dw, GETDATE()) = 2 --is it monday AND DATEPART(m, dbo.DateReceived) >= DATEPART(m, GETDATE()) - 1 --is it a later or equal to last month AND ( DATEPART(d, GETDATE()) = 1 -- is it the 1st day of the month OR DATEPART(d, GETDATE()) = 2 -- is it the 1st day of the month OR DATEPART(d, GETDATE()) = 3 -- is it the 1st day of the month ) OR DATEPART(m, dbo.DateReceived) >= DATEPART(m, GETDATE()) -- is it in the future
I have to be honest this looks kind of silly. The last line says anything the future is cool [:|]If all you are trying to determine is did it happen last month then the following should be closer:--display your rangeSelect convert(datetime,convert(varchar,dateadd(m,-1,dateadd(dd,1-day(getdate()),getdate())),101)), convert(datetime,convert(varchar,dateadd(dd,-day(getdate()),getdate()),101))--implementedWhere dbo.dateReceived between convert(datetime,convert(varchar,dateadd(m,-1,dateadd(dd,1-day(getdate()),getdate())),101)) and convert(datetime,convert(varchar,dateadd(dd,-day(getdate()),getdate()),101))
Corey