Database View Syntax for where clause
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2014 12:31 PM
I want to filter a database view so that the output is only certain values in the view. For example, on the task table, I want task to be of certain task type or certain states (tsk_sys_class_name = 'sc_request' AND tsk_state = '1')
but nothing I do seems to work.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 01:55 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 12:37 AM
http://wiki.servicenow.com/index.php?title=Database_Views
A typical view works best on the platform when the where clause only links references together with the purpose to join tables (TableA_sys_id = TableB_sys_id) but does not contain filters (active=true), those can be applied after the view has already done its join.
So make the join, hit "Try It", then apply your filters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2023 06:10 AM
Which would work great if the export of the filtered view didn't have blank rows in it! 😕
ex: database_table_name.do?EXCEL&sysparm_query=encoded_query
Shows the correct data, but includes blank rows for the rows that were filtered out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 11:01 PM
I got this working on a choice (TRUE/FALSE) field:
(cirel_child=eaapps_sys_id || cirel_parent=eaapps_sys_id) && eaapps_u_critical_application=1
The text in black joins two of the same tables with an OR condition. The text in red returns only TRUE values for the critical application field.
Took a lot of tries - I'm rapt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2019 02:27 PM
How do we create a view such that there are all the records of Table A and the records that link with Table A and B.
So, we have few cases and HR audit tasks(custom table) - both extended from the task table.
I need to report on both HR audit tasks which have HR cases and The Hr cases which do not have HR audit tasks. Unable to resolve this.
Thanks in Advance