select DISTINCT rwe.RWPARENT

  from CCRW rwe

    left outer join CCRW rwp on rwp.RWNAME=rwe.RWPARENT

    left outer join CCRW rwdp on (rwp.RWTYP || ':' || rwp.RWNAME)=rwe.RWPARENT

 where  rwp.RWTYP is null and rwdp.RWTYP is null