SELECT dc."deviceId"
FROM "devices_categories" dc, "adv_objects_categories" oc
WHERE dc."catId" = oc."categoryId" AND oc."objectId"=16
group by dc."deviceId"
having count(dc."catId")=(select count(*) from "adv_objects_categories" WHERE "objectId"=16)