I have a table with a sort of father-son relation
TABLE1
-----------
IDObject
IDObjectFather
Description
Is it possible to list all data, adding a colunm with the level of the current object (number of 'fathers' and 'father or fathers')?
IE:
1, NULL, A
2 , NULL, B
3, 1, C
4, 1, D
5, 3, E
6, 3, F
7, 6, G
I want:
1, NULL, A, 0
2 , NULL, B, 0
3, 1, C, 1
4, 1, D, 1
5, 3, E, 2
6, 3, F, 2
7, 6, G, 3
I know I do it using a cursor, but I think it is too slow (I have thousands of entries) and also not very pratic.
NetAngel
TABLE1
-----------
IDObject
IDObjectFather
Description
Is it possible to list all data, adding a colunm with the level of the current object (number of 'fathers' and 'father or fathers')?
IE:
1, NULL, A
2 , NULL, B
3, 1, C
4, 1, D
5, 3, E
6, 3, F
7, 6, G
I want:
1, NULL, A, 0
2 , NULL, B, 0
3, 1, C, 1
4, 1, D, 1
5, 3, E, 2
6, 3, F, 2
7, 6, G, 3
I know I do it using a cursor, but I think it is too slow (I have thousands of entries) and also not very pratic.
NetAngel