Something like:Code:Select * from (select streetName, count(houseNumber) over (partition by streetName) as tot_houses, sum(decode(occupiedFlag,'Y',1,0)) over (partition by streetName) as occ_houses) where occ_houses = tot_houses where occ_houses < tot_houses and occ_houses <> 0 where occ_houses = 0




Reply With Quote