Database view between cmdb_ci and cmdb_rel_ci tables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 10:40 AM
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 11:03 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 11:17 AM
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.
when I click it, it takes me to relationship table for that CI :
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 11:28 AM
Try where clause: ci_sys_id=rel_child || ci_sys_id=rel_parent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 03:37 PM
I have tried it.
I am getting transaction failed error everytime.