SELECT `e`.*, `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`, `cat_index`.`position` AS `cat_index_position`, `at_position`.`position` FROM `catalog_product_entity` AS `e`
INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '2' AND price_index.customer_group_id = 0
INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=2 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '2'
LEFT JOIN `aw_shopbybrand_brand_product` AS `at_position` ON (at_position.`product_id`=e.entity_id) AND (brand_id=2498) WHERE (`e`.`entity_id` IN('14544', '14716', '17179', '17278', '17355', '18584', '19877', '33026', '31377', '31344', '31241', '31345', '31168', '31291', '31358', '31253', '31303', '31446', '31102', '33968', '33969', '34154', '34400', '35570', '43710', '44002', '44201', '44202', '44252', '44254', '44256', '34399', '44276', '44303', '44306', '44307', '44342', '44390', '45158', '45159', '45160', '45161', '45671', '54392', '54393')) ORDER BY `at_position`.`position` DESC LIMIT 24