General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
The fact that you are asking about recursion suggests that you want to do it iterarively (for each value of IDCMP not merely IDCMP = 4 as in your example.
Will this work for you?
SELECT IDCMP FROM yourtable GROUP BY 1 INTO ARRAY a_idcmp
FOR EACH idc IN a_idcmp
cursorname = 'curs_' + alltrim(str(idc,5))
SELECT IDISM DISTINCT FROM yourtable ;
WHERE IDCMP = idc ;
INTO CURSOR &cursorname
ENDFOR
>I have a table with the follow records:
>
>IDCMP CHILDIDCMP IDISM
>1 NULL 10507
>2 NULL 10485
>3 NULL 13259
>4 NULL 14987
>4 16 NULL
>10 1 NULL
>16 NULL 14000
>16 3 NULL
>16 10 NULL
>
>I need to retrive ALL values of IDISM included in a IDCMP. For example: the values from IDISM in IDCMP = 4 are 14987,14000,13259,10507. Is it possible to use a recursion SQL statement to do this?
>
>I would appreciate any help that could be given.
>
>Thanks in advance.
>Augusto.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only