SELECT 1 AS `status`, `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, IF(at_s.value_id > 0, at_s.s, at_s_default.s) AS `s`, IF(at_t.value_id > 0, at_t.t, at_t_default.t) AS `t` FROM `catalog_product_flat_1` AS `e` INNER JOIN `catalog_product_entity` AS `at_s_default` ON (`at_s_default`.`entity_id` = `e`.`entity_id`) AND `at_s_default`.`store_id` = 0 LEFT JOIN `catalog_product_entity` AS `at_s` ON (`at_s`.`entity_id` = `e`.`entity_id`) AND (`at_s`.`store_id` = 1) INNER JOIN `catalog_product_entity` AS `at_t_default` ON (`at_t_default`.`entity_id` = `e`.`entity_id`) AND `at_t_default`.`store_id` = 0 LEFT JOIN `catalog_product_entity` AS `at_t` ON (`at_t`.`entity_id` = `e`.`entity_id`) AND (`at_t`.`store_id` = 1) WHERE ((IF(at_s.value_id > 0, at_s.s, at_s_default.s) = 'sku') OR (IF(at_t.value_id > 0, at_t.t, at_t_default.t) = 'type_id'))