SELECT p.`obj_id`
FROM `products` p
LEFT JOIN `objects` o ON p.`obj_id` = o.`id`
LEFT JOIN `objects_fields` oc ON p.`obj_id` = oc.`obj_id` AND oc.`field_id` = 248
LEFT JOIN `objects_fields` oc ON p.`obj_id` = oc.`obj_id` AND oc.`field_id` = 221
WHERE ".$where."";
SELECT p.`obj_id`
FROM `products` p
LEFT JOIN `objects` o ON p.`obj_id` = o.`id`
LEFT JOIN `objects_fields` oc ON p.`obj_id` = oc.`obj_id`
WHERE oc.`field_id` = 221 OR oc.`field_id` = 248