select o.objectId
from objects o
left join
(select objectId from objects_categories t1 left join device_categories t2
on t1.objectCat = t2.deviceCat
where t2.deviceCat is null or t2.deviceId<>1)
oc on
oc.objectId =o.objectId
WHERE oc.objectId IS NULL;