vijay11
asked on
Can some one help with this Sql
I have a table 'a' like this
parent child
9 10
9 11
I have a table 'b' like this
ID primary_id primary_name type
1 9 cal big
1 9 cal small
2 9 cal big
2 9 cal small
4 10 Nev small
4 10 Nev big
3 16 Ill big
I want the output like this ( For the primary_id in table 'b' I want the parent of and child of to be populated based
on table 'a' in the out put .
ID primary_id primary_name type parent of child of
1 9 cal big 10 null
1 9 cal small 10 null
1 9 cal big 11 null
1 9 cal small 11 null
2 9 cal big 10 null
2 9 cal small 10 null
2 9 cal big 11 null
2 9 cal small 11 null
4 10 Nev small null 9
4 10 Nev big null 9
3 16 Ill big null null
Thanks in advance
parent child
9 10
9 11
I have a table 'b' like this
ID primary_id primary_name type
1 9 cal big
1 9 cal small
2 9 cal big
2 9 cal small
4 10 Nev small
4 10 Nev big
3 16 Ill big
I want the output like this ( For the primary_id in table 'b' I want the parent of and child of to be populated based
on table 'a' in the out put .
ID primary_id primary_name type parent of child of
1 9 cal big 10 null
1 9 cal small 10 null
1 9 cal big 11 null
1 9 cal small 11 null
2 9 cal big 10 null
2 9 cal small 10 null
2 9 cal big 11 null
2 9 cal small 11 null
4 10 Nev small null 9
4 10 Nev big null 9
3 16 Ill big null null
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER