Database view left join isn't working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2018 12:26 AM
Hi All,
I have two tables: First is "core_company" which you all probably know, and a custom table "u_lp_vendor_contact".
For table "core_company" I added a custom field "u_company_type" with a value of "Vendor".
Table "u_lp_vendor_contact" has a reference field to core_company and represents contacts of vendors.
I am trying to build a database view that will present records from "core_company" table that don't have reference field in table "u_lp_vendor_contact".
When I run the database view with a left join=true, It ignores the condition of "u_company_type=Vendor", and even when I filter the results manually (u_company_type=Vendor), it doesn't return the right result.
The expected results when I run the query should be: "Unknown Vendor", "Vendor B", "Vendor C", "Equinix"
Attached: my database view, table core_company records, table u_lp_vendor_contact records, the result of database view run.
Please suggest what am I doing wrong.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 10:38 AM
I don't see any responses but did you ever figure this out. I'm running in a similar problem with a database view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 11:25 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 12:28 PM
This looks like creating a database view outside of ServiceNow which is not what I'm doing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2019 11:30 AM
The only workaround, which I found was removing of condition like t.u_company_type='Vendor' from the database view and usage of condition like t_u_company_type='Vendor' every time, when the database view need be used. It's very uncomfortable, but it works at least.