position----desc---SELECT DISTINCT `e`.`entity_id`, `e`.`type_id`, `e`.`attribute_set_id`, `cat_index`.`position` AS `cat_index_position`, `e`.`name`, `e`.`description`, `e`.`short_description`, `e`.`price`, `e`.`special_price`, `e`.`special_from_date`, `e`.`special_to_date`, `e`.`manufacturer`, `e`.`manufacturer_value`, `e`.`image`, `e`.`small_image`, `e`.`thumbnail`, `e`.`color`, `e`.`color_value`, `e`.`news_from_date`, `e`.`news_to_date`, `e`.`status`, `e`.`url_key`, `e`.`required_options`, `e`.`image_label`, `e`.`small_image_label`, `e`.`thumbnail_label`, `e`.`msrp_enabled`, `e`.`msrp_display_actual_price_type`, `e`.`msrp`, `e`.`tax_class_id`, `e`.`price_type`, `e`.`weight_type`, `e`.`price_view`, `e`.`shipment_type`, `e`.`links_purchased_separately`, `e`.`links_exist`, `e`.`bar_code`, `e`.`size`, `e`.`size_value`, `e`.`brand`, `e`.`brand_value`, `e`.`coming_soon`, `e`.`new`, `e`.`gender`, `e`.`gender_value`, `e`.`info_details`, `e`.`googleshopping_exclude`, `e`.`aw_gc2_amounts`, `e`.`aw_gc2_open_amount_min`, `e`.`aw_gc2_open_amount_max`, `e`.`item_code`, `e`.`hsn_code`, `e`.`gtin`, `e`.`ean`, `e`.`jan`, `e`.`is_accessories`, `e`.`disc_p`, `e`.`disc_p_value`, `e`.`disc_off`, `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`, IF(at_back_label.value_id > 0, at_back_label.value, at_back_label_default.value) AS `back_label`, (SELECT value FROM `catalog_product_entity_int` camp WHERE `camp`.`attribute_id` =(SELECT attribute_id FROM `eav_attribute` WHERE `attribute_code` = 'campaign_product') AND `camp`.`entity_id`=`e`.`entity_id`) AS `campaign`, (SELECT value FROM `catalog_product_entity_int` acc WHERE `acc`.`attribute_id` =(SELECT attribute_id FROM `eav_attribute` WHERE `attribute_code` = 'is_accessories') AND `acc`.`entity_id`=`e`.`entity_id`) AS `accessories` FROM `catalog_product_flat_10` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=10 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '479' INNER JOIN `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 INNER JOIN `catalog_product_index_eav` AS `size_idx` ON size_idx.entity_id = e.entity_id AND size_idx.attribute_id = '147' AND size_idx.store_id = 10 AND size_idx.value in ('193') LEFT JOIN `catalog_product_entity_varchar` AS `at_back_label_default` ON (`at_back_label_default`.`entity_id` = `e`.`entity_id`) AND (`at_back_label_default`.`attribute_id` = '175') AND `at_back_label_default`.`store_id` = 0 LEFT JOIN `catalog_product_entity_varchar` AS `at_back_label` ON (`at_back_label`.`entity_id` = `e`.`entity_id`) AND (`at_back_label`.`attribute_id` = '175') AND (`at_back_label`.`store_id` = 10) WHERE (e.status = 1) ORDER BY FIELD(campaign, 1) DESC, FIELD(accessories, 1) ASC
SELECT FILTERS
1

All Blacks