select dimuserenrollmentid, operation, intpartnerID, enrollmentid, userid, role, roletype, enrolledtoid, enrolledtotype, startdatetime, enddatetime, status, CreatedBy, UpdatedBy, CreatedDateTime, UpdatedDateTime, scdtimestamp, Isdeleted, statementid from dw.dimuserenrollment where rowversion > '2018/08/18 00:30:10.000000000' and rowversion <= '2018/09/11 08:44:51.000000000' and intpartnerid in ( select IntegrationPartnerName from etl.IntegrationPartner WHERE IntegrationPartnerID in ( SELECT cast(trim(split_part(t.id, ',', n.levelid + 1)) as int) As IntPartnerID FROM dw.dimparentchildlevel n cross join ( select '4,7' as id ) as t where trim(split_part(t.id, ',', n.levelid + 1)) <> '' and trim(split_part(t.id, ',', n.levelid + 1)) is not null ) )