Database view between cmdb_ci and cmdb_rel_ci tables

geet
Tera Guru

Hi All,

I am trying to create a database view by joining cmdb_ci & cmdb_rel_ci tables.

Purpose of this join is to find out which all CI have got relationship created and which all doesn't have relationship yet.

I created a database view as follows but it is not working. When I try it, it says no record to display.

Please advice what is wrong here?

find_real_file.png

 

6 REPLIES 6

Nia McCash
Mega Sage
Mega Sage

You are trying to match the CI's sys_id with the relationship's sys_id and that's not going to work.

You either need to check the relationship's child field (a CI) or the parent field (also a CI).

Try ci_sys_id = rel_child or ci_sys_id = rel_parent.

 

Hi,

 

But for that I have to create 2 different database vies, right?

 

because, when I open a CI and there is a related link show relationship.

find_real_file.png

when I click it, it takes me to relationship table for that CI :

find_real_file.png

 

by default it takes the filter for both parent and child for that CI as shown above.

Is there a way we can put both parent and CI in where clause?

Try where clause: ci_sys_id=rel_child  || ci_sys_id=rel_parent

I have tried it.

I am getting transaction failed error everytime.