Hi there
This query sould produce a single row result. instead of this I have a 3 row result (ie it seems it is not iterating, just looping throu all records
with ip (SYSTEM_ID, IP_ADDRESS) as
(
select distinct IP0.SYSTEM_ID,
cast('' as varchar(400))
from CEPPLUS.IP_INTERFACE IP0
where IP0.SYSTEM_ID = 188
union all
select IP1.SYSTEM_ID,
IP1.IP_ADDRESS + case when IP1.IP_ADDRESS = '' then '' else ', ' end + IP2.IP_ADDRESS
from ip IP1, CEPPLUS.IP_INTERFACE IP2
where IP1.SYSTEM_ID = IP2.SYSTEM_ID
and IP1.IP_ADDRESS = ''
)
select * from ip where IP_ADDRESS != ''
Here is the result:
SYSTEM_ID IP_ADDRESS
188 , 10.168.4.182
188 , 62.184.239.71
188 , 10.168.2.79
instead of the desired
SYSTEM_ID IP_ADDRESS
188 10.168.4.182, 62.184.239.71, 10.168.2.79