so you want last week's data, but only if it's in the current month?take a little time to understand the dateadd and datediff functions. for example:select dateadd(month, datediff(month, 0, getdate()), 0) -- first day of current monthselect dateadd(week, datediff(week, 0, getdate())-1, 0) -- first day of last weekselect dateadd(week, datediff(week, 0, getdate()), 0)-1 -- last day of last week
so your where clause will be similar to this:WHERE recvd_dt BETWEEN dateadd(week, datediff(week, 0, getdate())-1, 0) and dateadd(week, datediff(week, 0, getdate()), 0)-1AND recvd_dt >= dateadd(month, datediff(month, 0, getdate()), 0)