SQLTeam.com | Weblogs | Forums

Need Help in changing the condition query to capture previous week data

Hi All,

This query captures May2021 Monthly report. Need help in changing the conditon query to capture Previous week
Data. (1 week Data)

Here's the query:

SELECT
INC.[number] As 'INC_Number'
,CAST(INC.[opened_at] as datetime) As 'Opened_At'
,INC.[dv_cmdb_ci] As 'Configuration_Item'
,INC.[dv_caller_id] As 'Caller_ID'
,INC.[dv_u_service_recipient] As 'Service_Recipient'
,INC.[dv_assigned_to] As 'Assigned_To'
,INC.[dv_priority] As 'Priority'
,INC.[short_description] As 'Short_Description'
,INC.[dv_close_code] As 'Close_Code'
,INC.[dv_u_tracking_code_details] As 'Tracking_Code'
,CAST(INC.[resolved_at] as datetime) As 'Resolved_At'

FROM SN.[incident] INC

WHERE (INC.[resolved_at]>='2021-05-01 00:00:00' AND INC.[resolved_at]<'2021-06-01 00:00:00')
AND INC.[assignment_group] = 'bb676c63804'
AND INC.[state] IN('9','0')
ORDER BY INC.[resolved_at]