( select z.name as zone_name, c.name as collector_name, case when con.value = 'true' THEN 'enabled' else 'disabled' END as collector_state from collector AS c join zone AS z on z.id = c.zone_id join config AS con on con.collector_id = c.id and con.zone_id = z.id left join config as con2 on con2.collector_id = c.id and con2.key='invisible' where con.key = 'enabled' and (con2.collector_id is null OR con2.value='false') group by z.name, c.name, con.value order by z.name )