-- Product entity type ID SET @etype = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_product'); -- Product name attribute ID SET @name = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = @etype); -- Product name attribute ID SET @artist_name = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'artist_name' AND entity_type_id = @etype); SET @country_of_manufacture = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'country_of_manufacture' AND entity_type_id = @etype); SET @cs_sort_order = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'cs_sort_order' AND entity_type_id = @etype); SET @custom_design = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'custom_design' AND entity_type_id = @etype); SET @feed_dimensions = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'feed_dimensions' AND entity_type_id = @etype); SET @feed_product_image = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'feed_product_image' AND entity_type_id = @etype); SET @height = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'height' AND entity_type_id = @etype); SET @image = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'image' AND entity_type_id = @etype); SET @image_label = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'image_label' AND entity_type_id = @etype); SET @links_title = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'links_title' AND entity_type_id = @etype); SET @meta_description = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'meta_description' AND entity_type_id = @etype); SET @meta_title = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'meta_title' AND entity_type_id = @etype); SET @msrp_display_actual_price_type = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'msrp_display_actual_price_type' AND entity_type_id = @etype); SET @msrp_enabled = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'msrp_enabled' AND entity_type_id = @etype); SET @name = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'name' AND entity_type_id = @etype); SET @number_of_sales = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'number_of_sales' AND entity_type_id = @etype); SET @options_container = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'options_container' AND entity_type_id = @etype); SET @rating = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'rating' AND entity_type_id = @etype); SET @rf123_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'rf123_id' AND entity_type_id = @etype); SET @rf123_url = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'rf123_url' AND entity_type_id = @etype); SET @sale_price = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'sale_price' AND entity_type_id = @etype); SET @samples_title = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'samples_title' AND entity_type_id = @etype); SET @small_image = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'small_image' AND entity_type_id = @etype); SET @small_image_label = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'small_image_label' AND entity_type_id = @etype); SET @small_price = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'small_price' AND entity_type_id = @etype); SET @thumbnail = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'thumbnail' AND entity_type_id = @etype); SET @thumbnail_label = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'thumbnail_label' AND entity_type_id = @etype); SET @url_key = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'url_key' AND entity_type_id = @etype); SET @url_path = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'url_path' AND entity_type_id = @etype); SET @width = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'width' AND entity_type_id = @etype); -- Product name attribute ID SET @description = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'description' AND entity_type_id = @etype); -- Product price attribute ID SET @price = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'price' AND entity_type_id = @etype); -- Admin store ID SET @store = 0; -- Query SELECT e.entity_id AS 'id', e.sku, v1.value AS 'name', v2.value AS 'artist_name', v3.value AS 'width', v4.value AS 'country_of_manufacture', v5.value AS 'cs_sort_order', v6.value AS 'custom_design', v7.value AS 'feed_dimensions', v8.value AS 'feed_product_image', v9.value AS 'height', v10.value AS 'image', v11.value AS 'image_label', v12.value AS 'links_title', v13.value AS 'meta_description', v14.value AS 'meta_title', v15.value AS 'msrp_display_actual_price_type', v16.value AS 'msrp_enabled', v17.value AS 'description', v18.value AS 'number_of_sales', v19.value AS 'options_container', v20.value AS 'rating', v21.value AS 'rf123_id', v22.value AS 'rf123_url', v23.value AS 'sale_price', v24.value AS 'samples_title', v25.value AS 'small_image', v26.value AS 'small_image_label', v27.value AS 'small_price', v28.value AS 'thumbnail', v29.value AS 'thumbnail_label', v30.value AS 'url_key', v31.value AS 'url_path', si.qty AS 'stock qty', d1.value AS 'price' FROM catalog_product_entity e LEFT JOIN cataloginventory_stock_item si ON e.entity_id = si.product_id LEFT JOIN catalog_product_entity_varchar v1 ON e.entity_id = v1.entity_id AND v1.store_id = @store AND v1.attribute_id = @name LEFT JOIN catalog_product_entity_varchar v2 ON e.entity_id = v2.entity_id AND v2.store_id = @store AND v2.attribute_id = @artist_name LEFT JOIN catalog_product_entity_varchar v3 ON e.entity_id = v3.entity_id AND v3.store_id = @store AND v3.attribute_id = @width LEFT JOIN catalog_product_entity_varchar v4 ON e.entity_id = v4.entity_id AND v4.store_id = @store AND v4.attribute_id = @country_of_manufacture LEFT JOIN catalog_product_entity_varchar v5 ON e.entity_id = v5.entity_id AND v5.store_id = @store AND v5.attribute_id = @cs_sort_order LEFT JOIN catalog_product_entity_varchar v6 ON e.entity_id = v6.entity_id AND v6.store_id = @store AND v6.attribute_id = @custom_design LEFT JOIN catalog_product_entity_varchar v7 ON e.entity_id = v7.entity_id AND v7.store_id = @store AND v7.attribute_id = @feed_dimensions LEFT JOIN catalog_product_entity_varchar v8 ON e.entity_id = v8.entity_id AND v8.store_id = @store AND v8.attribute_id = @feed_product_image LEFT JOIN catalog_product_entity_varchar v9 ON e.entity_id = v9.entity_id AND v9.store_id = @store AND v9.attribute_id = @height LEFT JOIN catalog_product_entity_varchar v10 ON e.entity_id = v10.entity_id AND v10.store_id = @store AND v10.attribute_id = @image LEFT JOIN catalog_product_entity_varchar v11 ON e.entity_id = v11.entity_id AND v11.store_id = @store AND v11.attribute_id = @image_label LEFT JOIN catalog_product_entity_varchar v12 ON e.entity_id = v12.entity_id AND v12.store_id = @store AND v12.attribute_id = @links_title LEFT JOIN catalog_product_entity_varchar v13 ON e.entity_id = v13.entity_id AND v13.store_id = @store AND v13.attribute_id = @meta_description LEFT JOIN catalog_product_entity_varchar v14 ON e.entity_id = v14.entity_id AND v14.store_id = @store AND v14.attribute_id = @meta_title LEFT JOIN catalog_product_entity_varchar v15 ON e.entity_id = v15.entity_id AND v15.store_id = @store AND v15.attribute_id = @msrp_display_actual_price_type LEFT JOIN catalog_product_entity_varchar v16 ON e.entity_id = v16.entity_id AND v16.store_id = @store AND v16.attribute_id = @msrp_enabled LEFT JOIN catalog_product_entity_varchar v17 ON e.entity_id = v17.entity_id AND v17.store_id = @store AND v17.attribute_id = @description LEFT JOIN catalog_product_entity_varchar v18 ON e.entity_id = v18.entity_id AND v18.store_id = @store AND v18.attribute_id = @number_of_sales LEFT JOIN catalog_product_entity_varchar v19 ON e.entity_id = v19.entity_id AND v19.store_id = @store AND v19.attribute_id = @options_container LEFT JOIN catalog_product_entity_varchar v20 ON e.entity_id = v20.entity_id AND v20.store_id = @store AND v20.attribute_id = @rating LEFT JOIN catalog_product_entity_varchar v21 ON e.entity_id = v21.entity_id AND v21.store_id = @store AND v21.attribute_id = @rf123_id LEFT JOIN catalog_product_entity_varchar v22 ON e.entity_id = v22.entity_id AND v22.store_id = @store AND v22.attribute_id = @rf123_url LEFT JOIN catalog_product_entity_varchar v23 ON e.entity_id = v23.entity_id AND v23.store_id = @store AND v23.attribute_id = @sale_price LEFT JOIN catalog_product_entity_varchar v24 ON e.entity_id = v24.entity_id AND v24.store_id = @store AND v24.attribute_id = @samples_title LEFT JOIN catalog_product_entity_varchar v25 ON e.entity_id = v25.entity_id AND v25.store_id = @store AND v25.attribute_id = @small_image LEFT JOIN catalog_product_entity_varchar v26 ON e.entity_id = v26.entity_id AND v26.store_id = @store AND v26.attribute_id = @small_image_label LEFT JOIN catalog_product_entity_varchar v27 ON e.entity_id = v27.entity_id AND v27.store_id = @store AND v27.attribute_id = @small_price LEFT JOIN catalog_product_entity_varchar v28 ON e.entity_id = v28.entity_id AND v28.store_id = @store AND v28.attribute_id = @thumbnail LEFT JOIN catalog_product_entity_varchar v29 ON e.entity_id = v29.entity_id AND v29.store_id = @store AND v29.attribute_id = @thumbnail_label LEFT JOIN catalog_product_entity_varchar v30 ON e.entity_id = v30.entity_id AND v30.store_id = @store AND v30.attribute_id = @url_key LEFT JOIN catalog_product_entity_varchar v31 ON e.entity_id = v31.entity_id AND v31.store_id = @store AND v31.attribute_id = @url_path LEFT JOIN catalog_product_entity_decimal d1 ON e.entity_id = d1.entity_id AND d1.store_id = @store AND d1.attribute_id = @price;