Database view beween cmdb_ci table with other tables

anvitha ash
Tera Contributor

Hi,

 

I am trying to build database view between "cmdb_ci" table with "cmdb_ci_business_app", "cmdb_ci_desktop_software", "cmdb_rel_ci", "cmdb_ci_server"

 

I am stuck with what needs to be the where clause condition. I don't have exposure to CMDB tables and database view

anvithaash_0-1694801044810.png

 

can someone help me here please 

 

6 REPLIES 6

Jaspal Singh
Mega Patron
Mega Patron

Hi Anvitha,

Can you detail what is that you are trying to achieve by creating a view for these table. Can you help confirm the end goal or use case once.

Thanks for responding @Jaspal Singh ,

 

Cmdb_ci is the parent table and rest of the are child tables

 

We have 3 fields which in all those child tables which is not there in parent table (cmdb_ci)  we want to create a report and which requires fields from parent and child tables 

Create something as below 

JaspalSingh_0-1694808487963.png

 

Where clause for third row:

crel.parent=cserver.sys_id || crel.child=cserver.sys_id

You can try above similarly for remaining tables.

 

Row 3 : cmdb_rel_ci => where caluse: crel.parent=cserver.sys_id || crel.child=cserver.sys_id

Ex:

When I add row 4 : cmdb_ci_desktop_software, order: 300, prefix: cidesk,  => where clause:  cidesk.parent=crel.sys_id || cidesk.child=crel.sys_id ?? Is the understanding correct please do let me know