We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Merging Data from two (or more) table into one table

imrane
Kilo Expert

Hi everyone,

I use [task_time_worked]   to track time worked on Incident and RITM

I want to make a report "group by company"

But Company is not at the same place for both tables :

  • In Incident : task_time_worked.task.Incident.CallerId.Company
  • In Sc Req Itm : task_time_worked.task.sc_req_item.request.requested_for.Company

What I want to achieve : Having a table that is like this

Created (from task_time_worked)
Time Worked
User (form task_time_worked)
Task TypeCompany (from incident AND req_item)
20/08/201715minIDEIncCust1
20/08/201715minIDEReq_ItemCust1

In other word, I think I want to make a Union where I can use a "AS Company"

Do you have any clue or advice ?

Thanks a lot

1 ACCEPTED SOLUTION

imrane
Kilo Expert

Hi everyone,



I finally gave up.



I used a "scripts - background" to fill "compagny" using rules listed above for all Incidents and Requested Item.


I used a Business Rule to fill "company" automatically



I can now report on task.company as wanted


View solution in original post

5 REPLIES 5

Not applicable

adilrathore
ServiceNow Employee

You have the option of creating a new Database to merge data from two tables:



System Definition > Database Views


imrane
Kilo Expert

Thanks for all your answer



But I've already looked for Database Views, but it seems that my question was not clear enough



I want to merge both columns (task_time_worked.task.Incident.CallerId.Company   and   task_time_worked.task.sc_req_item.request.requested_for.Company) in same column in the database view.