> > hi all. im having a problem and wondering if anyone an help. i have the
> > following tables along with column names (too many columns so im just
[quoted text clipped - 45 lines]
> DB2 Information Integration Development
> IBM Germany
> with that being said i dont think the photos subselect will work for me
> in this case. any other possibilities?
The subselect is scalar. Thus, if you want to return more information and
can combine it into a single, scalar value, then you can still use the
subselect.

Signature
Knut Stolze
DB2 Information Integration Development
IBM Germany
This is not tested. Just an idea.
WITH
photos_rn AS (
SELECT folderid
, id
, ROWNUMBER() OVER(PARTITION BY folderid ORDER BY id) rn
FROM photos
)
,Recurse
(rn, fname, fid, categoryid, category, preview) AS (
SELECT 0
, F.name, F.id
, F.categoryid
, C.name
, CAST('' AS VARCHAR(50))
FROM folders F
, categories C
WHERE C.id = F.categoryid
UNION ALL
SELECT pre.rn + 1
, pre.fname
, pre.fid
, pre.categoryid
, pre.category
, pre.preview || ', ' || new.id
FROM Recurse AS pre
, photos_rn AS new
WHERE pre.rn < 100
AND new.folderid = pre.fid
AND new.rn = pre.rn + 1
)
SELECT fname, fid, categoryid, category, preview
FROM Recurse R
WHERE rn = (SELECT MAX(rn)
FROM Recurse RM
WHERE RM.fid = R.fid
)
;