CH4
SELECT DISTINCT `e`.*, `at_category_id`.`category_id`, `at_userid`.`userid`, IF(at_status.value_id > 0, at_status.value, at_status_default.value) AS `status`, IF(at_visibility.value_id > 0, at_visibility.value, at_visibility_default.value) AS `visibility`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `osn_catalog_product_entity` AS `e`
LEFT JOIN `osn_catalog_category_product` AS `at_category_id` ON (at_category_id.`product_id`=e.entity_id)
LEFT JOIN `osn_marketplace_product` AS `at_userid` ON (at_userid.`mageproductid`=e.entity_id)
INNER JOIN `osn_catalog_product_entity_int` AS `at_status_default` ON (`at_status_default`.`entity_id` = `e`.`entity_id`) AND (`at_status_default`.`attribute_id` = '96') AND `at_status_default`.`store_id` = 0
LEFT JOIN `osn_catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 11)
INNER JOIN `osn_catalog_product_entity_int` AS `at_visibility_default` ON (`at_visibility_default`.`entity_id` = `e`.`entity_id`) AND (`at_visibility_default`.`attribute_id` = '102') AND `at_visibility_default`.`store_id` = 0
LEFT JOIN `osn_catalog_product_entity_int` AS `at_visibility` ON (`at_visibility`.`entity_id` = `e`.`entity_id`) AND (`at_visibility`.`attribute_id` = '102') AND (`at_visibility`.`store_id` = 11)
INNER JOIN `osn_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 WHERE (IF(at_status.value_id > 0, at_status.value, at_status_default.value) = 1) AND (IF(at_visibility.value_id > 0, at_visibility.value, at_visibility_default.value) = '4') AND (at_userid.userid IN('422', '503', '3022', '3007', '3009', '3027', '3026', '3028', '3032', '3021', '3031', '3030', '3029', '3025', '3024', '47', '46', '3020', '3004', '3003', '3008', '340', '3005', '3010', '509', '2998', '3006', '3023', '602', '972', '411', '3012', '3011', '3013', '3014', '3016', '3019', '601')) AND (price_index.final_price = price_index.price) GROUP BY `e`.`entity_id` ORDER BY FIELD(at_userid.userid,422,503,3022,3007,3009,3027,3026,3028,3032,3021,3031,3030,3029,3025,3024,47,46,3020,3004,3003,3008,340,3005,3010,509,2998,3006,3023,602,972,411,3012,3011,3013,3014,3016,3019,601)
SELECT DISTINCT `e`.*, `at_category_id`.`category_id`, `at_userid`.`userid`, IF(at_status.value_id > 0, at_status.value, at_status_default.value) AS `status`, IF(at_visibility.value_id > 0, at_visibility.value, at_visibility_default.value) AS `visibility`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `osn_catalog_product_entity` AS `e`
LEFT JOIN `osn_catalog_category_product` AS `at_category_id` ON (at_category_id.`product_id`=e.entity_id)
LEFT JOIN `osn_marketplace_product` AS `at_userid` ON (at_userid.`mageproductid`=e.entity_id)
INNER JOIN `osn_catalog_product_entity_int` AS `at_status_default` ON (`at_status_default`.`entity_id` = `e`.`entity_id`) AND (`at_status_default`.`attribute_id` = '96') AND `at_status_default`.`store_id` = 0
LEFT JOIN `osn_catalog_product_entity_int` AS `at_status` ON (`at_status`.`entity_id` = `e`.`entity_id`) AND (`at_status`.`attribute_id` = '96') AND (`at_status`.`store_id` = 11)
INNER JOIN `osn_catalog_product_entity_int` AS `at_visibility_default` ON (`at_visibility_default`.`entity_id` = `e`.`entity_id`) AND (`at_visibility_default`.`attribute_id` = '102') AND `at_visibility_default`.`store_id` = 0
LEFT JOIN `osn_catalog_product_entity_int` AS `at_visibility` ON (`at_visibility`.`entity_id` = `e`.`entity_id`) AND (`at_visibility`.`attribute_id` = '102') AND (`at_visibility`.`store_id` = 11)
INNER JOIN `osn_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 WHERE (IF(at_status.value_id > 0, at_status.value, at_status_default.value) = 1) AND (IF(at_visibility.value_id > 0, at_visibility.value, at_visibility_default.value) = '4') AND (at_userid.userid IN('422', '503', '3022', '3007', '3009', '3027', '3026', '3028', '3032', '3021', '3031', '3030', '3029', '3025', '3024', '47', '46', '3020', '3004', '3003', '3008', '340', '3005', '3010', '509', '2998', '3006', '3023', '602', '972', '411', '3012', '3011', '3013', '3014', '3016', '3019', '601')) AND (price_index.final_price = price_index.price) GROUP BY `e`.`entity_id` ORDER BY FIELD(at_userid.userid,422,503,3022,3007,3009,3027,3026,3028,3032,3021,3031,3030,3029,3025,3024,47,46,3020,3004,3003,3008,340,3005,3010,509,2998,3006,3023,602,972,411,3012,3011,3013,3014,3016,3019,601)
Show Products Near By ?