JtheRipper
IS-IT--Management
Hi there,
I have a table that looks something like this: (parent-child relationship table)
If I can explain any further for example all the children of the parent device (id=2):
And so on...
Now, I want to know how do I can display the values like this for a given device_id:
Can this be done using a select statement using joins or do I have to write a cursor-type query to perform this?
Any input very much appreciated!
Thanks,
J.
I have a table that looks something like this: (parent-child relationship table)
Code:
Device_id parent type device_name ip mac
1 1 ROOT ROOT 1.1.1.1 ABC
2 1 NW NETP 1.1.2.3 ABS
3 2 SLOT 1
4 3 PORT 1
5 3 PORT 2
6 3 PORT 3
7 5 LINE 1
8 6 LINE 2
9 8 PC PC1 1.2.3.4 CBD
If I can explain any further for example all the children of the parent device (id=2):
Code:
->PORT1
NETP -> SLOT1 ->PORT2 ->LINE1
->PORT3 ->LINE2 ->PC1
And so on...
Now, I want to know how do I can display the values like this for a given device_id:
Code:
Port line ip mac PC
1
2 1
3 2 1.2.3.4 CBD PC1
Can this be done using a select statement using joins or do I have to write a cursor-type query to perform this?
Any input very much appreciated!
Thanks,
J.