Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Where clause on database view not working

gjz
Mega Sage

I have created a very simple database view on one table with a where clause to limit the data - but it doesn't work and I don't see why.

I'm using the Resource Plan table, and I want to eliminate all Operational resource plans - simple, right??

Can someone spot why this doesn't work?

My view:

find_real_file.png

The results:

find_real_file.png

Same limit on the table:

find_real_file.png

1 ACCEPTED SOLUTION

As a suggestion do below

Add same table again  to the database view with order 200 & prefix as ris

Then use where clause as

r.sys_id=ris.sys_id && ris.plan_type!='operational_work'

View solution in original post

9 REPLIES 9

Jaspal Singh
Mega Patron
Mega Patron

Can you try

r.plan_type!='Operational work' && r.plan_type!='operational_work'

Also, can't you simply apply the filter on the report that you create using database view

That was already tried and this isn't a report, it's a database view.

I understand it is a database view. Ultimately you will report on the database view only.

Can you share complete database view screenshot. As there is a need to understand the tables used.

A report will not be created from this view, it is to pull data for an external system. The screen shot is already on the post, it is a one table view with nothing complex, I simply want to eliminate some data from the pull.