Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Creating View for a table with parent child relation in table

$
0
0

I need help creating a view. It is on a base table which is a metadata table.It is usinf parent child relationship. There are four types of objects, Job, Workflow, Dataflow and ABAP dataflow. Job would be the root parent everytime. I have saved all the jobs of the project in another table TABLE_JOB with column name JOB_NAME. Query should iteratively start from the job and search all the child nodes and then display all child with the job name. Attached are the images of base table data and expected view data and also the excel sheet with data.Picture 1 is the sample data in base table. Picture 2 is data in the view.

Base Table
PARENT_OBJPAREBT_OBJ_TYPEDESCEN_OBJDESCEN_OBJ_TYPE
JOB_AJOBWF_1WORKFLOW
JOB_AJOBDF_1DATAFLOW
WF_1WORKFLOWDF_2DATAFLOW
DF_1DATAFLOWADF_1ADF
JOB_BJOBWF_2WORKFLOW
JOB_BJOBWF_3WORKFLOW
WF_2WORKFLOWDF_3DATAFLOW
WF_3WORKFLOWDF_4DATAFLOW
DF_4DATAFLOWADF_2ADF

View
Job_NameFlow_NameFlow_Type
Job_AWF_1WORKFLOW
Job_ADF_1DATAFLOW
Job_ADF_2DATAFLOW
Job_AADF_1ADF
Job_BWF_2WORKFLOW
Job_BWF_3WORKFLOW
Job_BDF_3DATAFLOW
Job_BDF_4DATAFLOW
Job_BADF_2ADF

I implemented the same in oracle using CONNECT_BY_ROOT and START WITH.

Regards,

Megha


Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>