Export Inventario Prestashop

Appunti per un test.
Una query sql per fare l’export dei prodotti per avere un inventario prestashop:

SELECT p.id_product AS  'ID', p.reference AS  'REFERENZA', p.ean13, pl.name AS  'NOME', m.name AS MARCA, cl.name AS CATEGORIA, sa.quantity AS  'QUANTITA', p.wholesale_price AS  'P. ACQUISTO', p.price AS  'P. VENDITA'
FROM ps_product AS p
LEFT JOIN ps_product_lang pl ON p.id_product = pl.id_product
LEFT JOIN ps_manufacturer m ON p.id_manufacturer = m.id_manufacturer
LEFT JOIN ps_stock_available sa ON p.id_product = sa.id_product
LEFT JOIN ps_category_lang cl ON p.id_category_default = cl.id_category
WHERE sa.quantity >= 1
GROUP BY p.reference