SQL Select

{{{Executed SQL}}{{Executed SQL}}{{Executed SQL}}{{Mage_Core}}}
SELECT `main`.`value_id`, `main`.`value` AS `file`, `main`.`entity_id` AS `product_id`, `value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`, `default_value`.`position` AS `position_default`, `default_value`.`disabled` AS `disabled_default` FROM `catalog_product_entity_media_gallery` AS `main` LEFT JOIN `catalog_product_entity_media_gallery_value` AS `value` ON main.value_id = value.value_id AND value.store_id = 1 LEFT JOIN `catalog_product_entity_media_gallery_value` AS `default_value` ON main.value_id = default_value.value_id AND default_value.store_id = 0 WHERE (main.attribute_id = '88') AND (main.entity_id in ('242')) ORDER BY IF(value.position IS NULL, default_value.position, value.position) ASC
value_id file product_id label position disabled label_default position_default disabled_default
663 /F/9/F90120002_1.jpg 242 CROSBY • SOFA 1 0
664 /F/9/F90120002-2_1.jpg 242 CROSBY • SOFA 2 0