Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- a.pid,
- a.artno,
- a.name_se,
- a.type_se,
- a.disable_se,
- GROUP_CONCAT(e.name_se SEPARATOR ' - ') as Kategorinamn,
- (SELECT SUM(af_skus.QuantityAvailable) FROM af_skus WHERE af_skus.ArtNo=a.artno AND af_skus.StockCode IN ('SL', 'HL')) as Lagersaldo,
- a.discontinued_code,
- a.is_package_article,
- a.image_exist as Bild_finns_på_trademax,
- a.price_se,
- a.rek_price_se,
- ROUND(a.calculated_purchase_price*1.175,0) "Bygghemma_Inpris",
- a.description_se
- FROM af_products a
- LEFT JOIN af_products_to_categories b ON b.pid=a.pid
- LEFT JOIN af_categories e ON e.catid=b.catid
- WHERE b.catid IN (100, 236, 237, 238, 239, 240, 53, 101, 103, 104, 290, 291, 292, 293, 294, 295, 296, 301, 359, 5, 30, 51, 110, 165, 303, 348, 34, 43, 45, 358, 353, 347, 355, 356, 375, 41, 42, 46, 49, 357, 352, 432, 35, 48, 71, 40, 47, 54)
- AND manufacturers_id NOT LIKE '5432232' AND manufacturers_id NOT LIKE '3523537'
- GROUP BY a.pid
- HAVING Lagersaldo > 5
- ORDER BY kategorinamn, disable_se, Bild_finns_på_trademax DESC, artno ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement