Narrowing the database view with a where clause
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 06:37 PM
In the tasks table, I want to display only records whose Task type is Application and Request task (u_application_and_request_task) or Reservation and Result (u_reservation).
I have set the condition in the where clause as follows, but records of other Task types (e.g. incident) are also displayed.
How can I fulfill this requirement?
I do not want to use the filter function.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 07:25 PM
Hi @miyu ,
Use of the 'Where clause'
The 'Where clause' in a database view is primarily used to specify join conditions.
It cannot be used to filter based on field values (ex. 'Active' = 'true').
Follow below support article for better understanding:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719186
Aman Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 08:04 PM
Thank you for your response.
If I want to filter based on field values, do I have to use the filter function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 08:49 PM
Hi @miyu ,
I see issue with the format of condition you have used. Try the below condition and check if it works:
task_sys_class_name == "u_applicatioion_and_request_task"" || task_sys_class_name == "u_reservation"
I hope this help.
Please mark this helpful if this helps and Accept the solution if this solves your issue.
Regards,
Kamlesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2022 08:52 PM
Yes
Aman Kumar