select DISTINCT rwe.RWPARENT
  from CCRW rwe
    left outer join CCRW rwp on rwp.RWNAME=rwe.RWPARENT
    left outer join CCRW rwdp on CONCAT_WS(':',rwp.RWTYP,rwp.RWNAME)=rwe.RWPARENT
    left outer join CCRW rwhp on CONCAT_WS('.',rwp.RWTYP,rwp.RWNAME)=rwe.RWPARENT
 where  rwp.RWTYP is null and rwdp.RWTYP is null and rwhp.RWTYP is null
