Hi all,
I've the following two tables -
MasterData -
Project_ID | Category | Parent_ID |
P1 | A | NULL |
P2 | A | NULL |
P3 | A | NULL |
P4 | A | P1 |
P5 | A | P1 |
P6 | E | NULL |
P7 | A | P2 |
P8 | A | P2 |
P9 | A | P3 |
P10 | D | P6 |
Project_Totals
Project_ID | Total |
P1 | 500 |
P2 | 600 |
P6 | 700 |
P10 | 800 |
I need to join these two tables and get projects AND their child projects based on the condition Category = A.
Expected Results -
Project_ID | Total |
P1 | 500 |
P2 | 600 |
P4 | NULL |
P5 | NULL |
P7 | NULL |
P8 | NULL |
So the projects from Project_totals have to be first obtained with category 'A' condition and their corresponding child projects have to be fetched from Masterdata. I'm not able to construct the query to get the desired results. Can someone help me?
NLV - MCTS - Blog - Twitter - In