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

The purpose of database at all is not being sufficied & neither is your business case.

I believe it is pulled it will via API all you need is to share the API details by applying appropriate filters.

I appreciate your viewpoint, but the business requirement is to create a database view that will be pulled via an API, not get the data directly from the table.  

Do you know why the database view is not working?

 

Unfortunately it will not work.

Database view is combination of two or more tables. So, the purpose itself is defeated if a single table is used.

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'

Thanks, I ended up doing something close to this.  I just added another table that had a reference in the resource plan table and joined on the sys_id, it worked.  I think your solution is probably cleaner, though.