database view

pramn
Tera Guru

Hi Guys , 

I just created a database view for reporting purpose, using demand and project table 

in both table we have number is common 

after giving clause when i hit try it , no records are coming, however we have records on that tables 

pramn_0-1756882390607.png

how do i fix this ?

thanks for your help 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@pramn 

your where clause is wrong

on dmn_demand table the field project refers to pm_project table

So update where clause on demand as this and remove the where clause from project table

dmn_project=pro_sys_id

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

JackieZhang
Tera Contributor

the where condition should be like pro_demand = dmn_number. 

Ankur Bawiskar
Tera Patron
Tera Patron

@pramn 

your where clause is wrong

on dmn_demand table the field project refers to pm_project table

So update where clause on demand as this and remove the where clause from project table

dmn_project=pro_sys_id

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Bhuvan
Tera Sage

@pramn 

 

See below for sample project and demand table records

Bhuvan_0-1756883586360.png

Bhuvan_1-1756883598246.png

'project' field in 'dmn_demand' table refers to 'sys_id' field of 'pm_project' table.

 

Change your query to dmn_project=pro_sys_id

 

If you are creating database views for reporting purposes, check if there is a need to create it in the first place. You can dot-walk on the related tables and show the information in dashboards and reports. In addition, you have various ways to group or manipulate the data without the need for view tables.

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

@pramn 

 

Did you get a chance to review this ?

 

As per community guidelines, you can accept more than one answer as accepted solution. If my response helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan