your query only reports SSN which have Exactly 2 accounts
Code:
select c.* from
(select dbname
from sysibm.systablespace a
group by dbname
having count(*) > 1
fetch first 10 rows only) A
, table (select * from sysibm.systablespace b where a.dbname = b.dbname
fetch first 2 rows only) C
SELECT C.COL1, C.COL2
FROM
(SELECT COL2
FROM Table1 A
GROUP BY COL2
HAVING COUNT(*) > 1
FETCH FIRST 10 ROWS ONLY) A,
TABLE (SELECT * FROM Table1 B
WHERE A.COL2=B.COL2
FETCH FIRST 2 ROWS ONLY) C;
seeing the sysibm tables in your query, first i thought what a complex query it is ..then i understood your intent..thank you very much