SELECT  cpf.entity_id AS products_id,  cpf.sku AS products_model,  csi.qty AS products_quantity,

(SELECT cped.value  	FROM catalog_product_entity_media_gallery cped   join eav_attribute eava on
eava.attribute_id =  cped.attribute_id  and eava.attribute_code = 'media_gallery' 
join catalog_product_entity_media_gallery_value mgv on mgv.value_id = cped.value_id
where cped.entity_id = cpf.entity_id order by mgv.position limit 1) 

 as product_image,  0 AS products_price, 0.00 AS price1, 
(SELECT cped.value  	FROM catalog_product_entity_decimal cped   join eav_attribute eava on
eava.attribute_id =  cped.attribute_id  and cped.store_id = <@PREFIX> and eava.attribute_code = 'price' 
where cped.entity_id = cpf.entity_id ) 
 AS price2, 0.00 price3, cpf.created_at AS products_date_added,  cpf.updated_at AS products_last_modified,  cpf.created_at AS products_date_available,  0 AS products_weight,
  1 products_status,  0 AS products_tax_class_id, 
(sELECT   cped.value 	FROM catalog_product_entity_varchar cped   join eav_attribute eava on
eava.attribute_id =  cped.attribute_id  and cped.store_id = <@PREFIX> and eava.attribute_code = 'manufacturer'
 where cped.entity_id = cpf.entity_id )  
 manufacturers_id,  0 products_ordered, 
(sELECT   cped.value 	FROM catalog_product_entity_varchar cped   join eav_attribute eava on
eava.attribute_id =  cped.attribute_id  and cped.store_id = <@PREFIX> and eava.attribute_code = 'name'
 where cped.entity_id = cpf.entity_id )  

 AS products_name  FROM catalog_product_entity cpf left join  
cataloginventory_stock_item csi on (cpf.entity_id = csi.product_id) 

 
where
1 = 1