>>select M.Numero >>from Master M inner join ManyToManyTable MM on M.Numero = MM.NoMaster >>inner join ChildTable C on MM.NoChildTable = C.Numero >>group by M.Numero >>having min(case when C.Enabled = 1 then 1 else 0 end) = 1 -- means all records are enabled >>and sum(case when C.Enabled = 1 then 1 else 0 end) = count(C.Numero) -- total number of enabled records = total number of joined records>