Left join use View Table. Desired View cannot be implemented

YoungJae Kim
Tera Contributor

I can't get the results I want using the View table.

Please help.

 

The Table is Three.

1. Hardware Asset

2. Request Asset 

3. Catalog Task

 

 

 

1. Hardwarwe Asset 

alm_hardware_1.png

 

2. Request Asset - Column Hardware Asset is Hardware Asset Table sys_id 

   ( The relationship between hardware assets and request assets is 1:N )

   There is no column called 'Day' in Hardware Asset, so it must be obtained from Request Asset.

    The column representing the Request Asset of status of the value is not String.
    It is a reference and you should look at the short Desc column in Catalog Task Table.

request asset table(custom).png

 

3. Catalog Task - Column Number(SYS_ID) is Request Asset Column Catalog Task

   

catalog task.png

 

 

I would like to display the date of data in the Hardware Asset that has a value in the Request Asset table and the Short_Desc in the Catalog Task table is 'Confirm'.

The result I want is as follows.

원하는결과1.png

 

 

but, I tried to implement it using Database View, but it failed.

where cluase - Request Asset_u_hardware_asset = Hardware Asset_sys_id

                            Request Asset_u_catalog_task = Catalog Task_sys_id && Catalog Task_short_desc = 'Confirm'

View Table Setting~~~.png

 

Result - A duplicate Hardware Asset

aaaa.png

 

I would like to implement the following query in View. Is this possible?

 SELET * FROM Hardwarwe T1
  LEFT JOIN (
   SELECT * FROM
   Request T2, Catalog T3
   Where T2.Catalog_task = T3.SYS_ID
   and T3.Short_description='Confirm'
  ) T4
 ON T1.SYS_ID = T4.HARDWARE_ASSET

 

After creating a view that only searches for data that confirms t2 (Request Asset) and t3 (Catalog Task),

If this view join to the t1(Hardware Asset) And Create new view
I can get the results I want.
However, Can't create a Database View using Another Database View
The function I want is not implemented.

 

How can I solve this? Thanks

1 REPLY 1

Peter Bodelier
Giga Sage

Hi @YoungJae Kim 

 

The where clause is ment to join the tables. It looks more like you're trying to filter as well. That will not work.

 

Please check Filtering using the 'Where clause' in database views - Support and Troubleshooting (servicenow.com) for your reference.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.