How to write a "where clause" in a database view

vishnumaaya
Tera Contributor

Hi, 

 

1. After creating a database view , adding the tables you want to combine , how to define where clause?

2. How do we know which one to write where clause for??

3. For example, see the picture below,

vishnumaaya_0-1740660780885.jpeg

- How to judge where to write the Where clause? as in where clause is written near the change_request and not task_sla 

- Why was it written in change request where clause?

- Why did it not use change_request_sla table n used task_sla table??

 

Please share any article, blog or videos if you have. 

 

Thanks,

Vaishnavi

1 ACCEPTED SOLUTION

Viraj Hudlikar
Giga Sage
In this ServiceNow Tutorial, Aaron Elder gives a demo on creating and using a database view in ServiceNow. Create the database view. Role required: admin. Learn more: https://docs.servicenow.com/bundle/paris-platform-administration/page/use/reporting/task/t_CreateADatabaseView.html ...
This Video explains how to develop a Servicenow Database View.
Hi Folks, In this tutorial we will be focusing on 3 aspect wrt Servicenow Database view What is ServiceNow Database View ? How to Create ServiceNow Database View ? How to Use ServiceNow Database View ? Lets understand the The value of ServiceNow database views ServiceNow is built to be dependent ...
Hi Folks, In this tutorial we will be focusing on 3 aspect wrt Servicenow Database view What is ServiceNow Database View ? How to Create ServiceNow Database View ? How to Use ServiceNow Database View ? Lets understand the The value of ServiceNow database views ServiceNow is built to be dependent ...
9 REPLIES 9

Hi,

 

I have multiple tables added,

 

incident_metric, cmdb_ci_outage and u_business_unit (custom table which has markets details).

 

I would want Incident number column, Outage number column, Duration(Outage) column and business unit column (where the outage has occurred) . How can I write database view for this?

 

Thanks,

Vaishnavi

Hi @vishnumaaya 

 

So on this case  you need to find out what is common in table and then create the where clause  to get the results, You can look OOTB database view to get an idea.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Community Alums
Not applicable

Hi @vishnumaaya ,

 

Viraj Hudlikar
Giga Sage
In this ServiceNow Tutorial, Aaron Elder gives a demo on creating and using a database view in ServiceNow. Create the database view. Role required: admin. Learn more: https://docs.servicenow.com/bundle/paris-platform-administration/page/use/reporting/task/t_CreateADatabaseView.html ...
This Video explains how to develop a Servicenow Database View.
Hi Folks, In this tutorial we will be focusing on 3 aspect wrt Servicenow Database view What is ServiceNow Database View ? How to Create ServiceNow Database View ? How to Use ServiceNow Database View ? Lets understand the The value of ServiceNow database views ServiceNow is built to be dependent ...
Hi Folks, In this tutorial we will be focusing on 3 aspect wrt Servicenow Database view What is ServiceNow Database View ? How to Create ServiceNow Database View ? How to Use ServiceNow Database View ? Lets understand the The value of ServiceNow database views ServiceNow is built to be dependent ...