Database view - union

gkr
Kilo Contributor

Hi All,

I am looking to Union 3 DB   tables (incident, problem, change_request) to get the joint result set with common fields. I would appreciate if you can guide me in right direction.

Thanks,

6 REPLIES 6

sb1186
Kilo Guru

Hi,



It is possible to create a database view joining n number of tables. Below is an example of the same:


find_real_file.png


This view joins the data from three different tables, i.e., incident, metric_instance and metric_definition.



You need to define a variable under Variable prefix column for each of the tables used and then use this variable to relate to a field from another table under the Where clause column with the appropriate condition.



Let me know in case you need further help with building the view..



PS: Mark this answer as Correct if it solved your query or hit Like/Helpful depending upon the usefulness of the response.



Regards,
Supriya Bisht


gkr
Kilo Contributor

Hi Supriya,


Thanks for the quick reply.



Our requirement is to get the result set from 3 tables into 1 with Union or equitant. Number of columns should remain same regardless of number of Unions.



Join gets columns from different tables. More number of joins mean, more number of columns. This approach is not suitable for us.


Any ideas.



Thanks


pratap1
Giga Contributor

Hi GK,



      I have also the same requirement. Is your Issue is resolved. If yes, then how you achieved it.




Thanks



Best regards,


Pratap Ranawat


You can try reporting on Task table with Group by as Task Type.