Jump to content

Edit History

MarcoFuerte

MarcoFuerte

Sorry ... war gestern schon im bett ...

hab es fertig .. falls jemand sowas gebrauchen kann dann hier :

ggf. interval und kategorie ändern ...

z.b. hier auf 90 day     und dann auch  IDEAL 3M   -

 

_________________________________________________________________________________________________________________________

SELECT
                a.id_product, a.`reference`AS 'ART.NO', b.`name` AS 'PRODUKT',  sav.`quantity` AS 'AKTUELLER LAGERBESTAND', sum(d.product_quantity) AS 'VERKAUFT',  round(sum(d.product_quantity) * 1.10 ) - sav.quantity  AS 'IDEAL 3M',   cl.name as 'KATEGORIE'
            FROM ps_order_detail d
            JOIN ps_orders x ON ( d.id_order = x.id_order AND (x.`date_add` BETWEEN  date_sub(now(), interval 90 day) AND now() )  )
            JOIN `ps_product` a ON (d.product_id = a.id_product)
        
            JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1)
            JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
        JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default and cl.id_category = 3)
             JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product`)
          
             GROUP BY a.id_product  
             ORDER BY  sav.`quantity` ASC 

_______________________________________________________________________________________________________________________________

 

Danke Marco

MarcoFuerte

MarcoFuerte

Sorry ... war gestern schon im bett ...

hab es fertig .. falls jemand sowas gebrauchen kann dann hier :

ggf. interval ändern ... z.b. hier auf 90 day     und dann auch  IDEAL 3M

 

_________________________________________________________________________________________________________________________

SELECT
                a.id_product, a.`reference`AS 'ART.NO', b.`name` AS 'PRODUKT',  sav.`quantity` AS 'AKTUELLER LAGERBESTAND', sum(d.product_quantity) AS 'VERKAUFT',  round(sum(d.product_quantity) * 1.10 ) - sav.quantity  AS 'IDEAL 3M',   cl.name as 'KATEGORIE'
            FROM ps_order_detail d
            JOIN ps_orders x ON ( d.id_order = x.id_order AND (x.`date_add` BETWEEN  date_sub(now(), interval 90 day) AND now() )  )
            JOIN `ps_product` a ON (d.product_id = a.id_product)
        
            JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1)
            JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)
        JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default and cl.id_category = 3)
             JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product`)
          
             GROUP BY a.id_product  
             ORDER BY  sav.`quantity` ASC 

_______________________________________________________________________________________________________________________________

 

Danke Marco

×
×
  • Create New...