Hi,
I am trying to get records for the previous month and when they aren't finalsed\final. The SQL i have works correctly but the not like is also removing all the records that have a null in the [MTR_STATUS_CD] column.
Can anyone tell me why?
SELECT *
FROM [MTR_MAT_SUPER_TYPE]
WHERE DATEPART(m, [MTR_LODG_DATE]) = DATEPART(m, DATEADD(m, -1, getdate()))
AND [MTR_REG_CODE] is not null
AND [MTR_STATUS_CD] NOT LIKE 'FINAL'
ORDER BY [MTR_JS_CODE]
I am trying to get records for the previous month and when they aren't finalsed\final. The SQL i have works correctly but the not like is also removing all the records that have a null in the [MTR_STATUS_CD] column.
Can anyone tell me why?
SELECT *
FROM [MTR_MAT_SUPER_TYPE]
WHERE DATEPART(m, [MTR_LODG_DATE]) = DATEPART(m, DATEADD(m, -1, getdate()))
AND [MTR_REG_CODE] is not null
AND [MTR_STATUS_CD] NOT LIKE 'FINAL'
ORDER BY [MTR_JS_CODE]