G007 AFFILATES HOULD RETURN ALL DIRECT SUB AND SUB TO SUB LEVEL AFFILIATES. CAN BE TO NTH LEVEL HOW TO QUERY in DB2?
AREVA_COMPANIES --------------------------- COMPANY_CODE|AFFILIATE_CODE G007 |K001 G007 |K002 G007 |K003 G007 |K004 K001 |K010 K001 |K011 K001 |K012 K002 |K020 K002 |K031 K004 |K067
WITH ALL_AFFILIATES(COMPANY_CODE,AFFILIATE_CODE) AS ( SELECT COMPANY_CODE, AFFILIATE_CODE FROM AREVA_COMPANIES WHERE COMPANY_CODE = 'G007' UNION ALL SELECT B.COMPANY_CODE, B.AFFILIATE_CODE FROM AREVA_COMPANIES B , ALL_AFFILIATES A WHERE B.COMPANY_CODE = A.AFFILIATE_CODE ) SELECT COMPANY_CODE, AFFILIATE_CODE FROM ALL_AFFILIATES
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)