- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2019 01:37 PM
U'm having trouble adding a date parameter in the where clause.
Created in last 6 months
Can someone provide me with an example?
Solved! Go to Solution.
- Labels:
-
Analytics and Reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2019 08:34 PM
Hello,
Following is the where clause to show the incidents created in last 6 months when used in a Database View record:
inc.sys_created_on>= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
inc is the variable prefix for incident table.
Did some trial and error to find out ServiceNow utilizing the MariaDB syntax for those conditions. Here's how you can get last month's date in MariaDB:
SELECT DATE_SUB(CURDATE(), INTERVAL 1 MONTH);
Give it a try, and let me know how it goes.
Hope this helps!
Cheers,
Manish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2020 09:22 AM
Did you find a solution for this?
I cannot use the reports to filter the date as left join will result in incorrect data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 06:20 AM
I should have mentioned that I had tried that and I get this error:
Error Message

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2019 05:23 PM
Oh strange! I tried the same and it worked for me. Here's the screenshot of what I put in my condition:
And here's the resulting database view:
But I wonder if it has to do something with the version. I had tried that in Madrid version, I see that you are on London.
The only change I see is that I used dot walk-ins in my queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2022 11:47 PM
It is not working for me . I have tried same solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2020 09:16 AM
Where you able to find a solution for adding a date parameter in Database view ?