Devices in production on a Location not in production SELECT bizDevice AS d JOIN bizLocation AS l ON d.location_id = l.id WHERE l.status != 'production' false 1 Devices not attached to a monitoring group SELECT bizDevice AS d JOIN lnkInfraGrouping AS l ON l.infra_id = d.id JOIN bizInfraGroup AS g ON l.infra_group_id = g.id WHERE g.type = 'Monitoring' true 1