sql query db2 9.7

37 views Asked by At

Recursive query in DB2 to get items in the chain. There is a table

WITH t (id,a) AS (VALUES (1,3),(1,6),(1,9),(2,7),(2,11),(3,5))
SELECT * FROM t

The output should be like this

id   | a
------------
1    | 3,6,9

2    | 7,11

3    | 5

How can I do this using recursive query? Thanks in advance.

0

There are 0 answers