Wow, that is really wild! I don't quite understand what is happening. Could you
show me the example with table ORDER and columns ORD_NUM and CUST_ID?
This would help me to see what is table data and what is IBM SQL
reserved words.
What is "WITH B (CKEY,LVL) "? Is this part of the syntax I would type in or is
it part of your explanation?
I am trying to use this with IBM's JDBC driver. I wonder if that will make a difference.
Thanks, this will be really helpful if it works!
Mike
Main Topics
Browse All Topics





by: odessaPosted on 1998-12-04 at 00:10:43ID: 1026049
In fact one way is by recursion
WITH B (CKEY,LVL)
(SELECT DISTINCT PKEY, 0
FROM TROUBLE
WHERE PKEY = 0
UNION ALL
SELECT C.CKEY, P.LVL +1
FROM TROUBLE
WHERE PKEY NOT IN (SELECT CKEY FROM PARENT)
)
SELECT CKEY, LVL
FROM PARENT
WHERE LVL < 50;
HOPE it's helpful