Skip to content
Advertisement

Need help eliminating Null data and retrieving last months records

I feel like I am pretty close on this one, but my where statement isn’t working correctly. My service column is still populating the NULL data. The other part that I need help with is pulling just last months data. If you look at the image, the date format is 2020-03-14 17:38:00.

enter image description here

Let me know if have any tips on my formatting, this is new to me.

Current code:

This is before the last month code: enter image description here

This is after the code:

enter image description here

Advertisement

Answer

There are multiple requirements in your question, let me address one-by-one.

CLIENT_SCREENING_TOOLS.TEST_NAME != ‘NULL’

This is incorrect, NULL is not a string to compare using != operator. The correct way is to use IS NOT NULL:

the date format is 2020-03-14 17:38:00

DATE doesn’t have any format. What you see is the way it is displayed as per your locale-specific NLS settings.

You have coded your CASE expression to have NULL value as string in the ELSE part:

Whenever the THEN expression is not met, it will display 'NULL' as string.

Instead, you could simply make your filter condition as:

The other part that I need help with is pulling just last months data

To get LAST MONTH data, you could use below condition:

For example,

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement