How to create a Database view for three tables

TechLead_vikas
Tera Contributor

Hi All,

I have a doubt for creating a Database view for three tables.

I have Authoritative source content, Control and Policy table.

Authoritative source contents are linked to Control and Controls are linked to Policy, Authoritative source content and Policy tables they don't have direct relationship and I need to show relationship between them.

Please help me with this.

Thanks and Regards,

Vikas Ambulgekar

1 ACCEPTED SOLUTION

tanumoy
Tera Guru

I have created a database view in my instance. Giving a screenshot as sample. Basically you need to build the relationship between 1st and 2nd table and then 2nd table with 3rd table. In my case 1st table was sys_user_role 2nd table was sys_user_has_role and 3rd one was sys_user.



Capture.JPG


View solution in original post

4 REPLIES 4

tanumoy
Tera Guru

I have created a database view in my instance. Giving a screenshot as sample. Basically you need to build the relationship between 1st and 2nd table and then 2nd table with 3rd table. In my case 1st table was sys_user_role 2nd table was sys_user_has_role and 3rd one was sys_user.



Capture.JPG


Thanks Paul


Daniel Draes
ServiceNow Employee
ServiceNow Employee

Yes, you can do this. Start with two tables first (Authoritative source and Control). Once this works you can add the third one.



This will involve   quite some trial and error ... been there, done that



The Database view module has an order attribute. This is the sequence NOW will link the tables. Make sure Authoritative source is the first, Control the second and Policy the third.


Chandra Rawat
Kilo Contributor

Yes you can create database view for more than two table but for 3rd and Fourth Table you have one common field which is of reference type and in Where Clause you can use Sys_id always as a condition 

for example a_number=b_sys_id

Please hit like if this answer is helpful for you.

Regards,
CHandra