Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. SELECT
  2. a.pid,
  3. a.artno,
  4. a.name_se,
  5. a.type_se,
  6. a.disable_se,
  7. GROUP_CONCAT(e.name_se SEPARATOR ' - ') as Kategorinamn,
  8. (SELECT SUM(af_skus.QuantityAvailable) FROM af_skus WHERE af_skus.ArtNo=a.artno AND af_skus.StockCode IN ('SL', 'HL')) as Lagersaldo,
  9. a.discontinued_code,
  10. a.is_package_article,
  11. a.image_exist as Bild_finns_på_trademax,
  12. a.price_se,
  13. a.rek_price_se,
  14. ROUND(a.calculated_purchase_price*1.175,0) "Bygghemma_Inpris",
  15. a.description_se
  16. FROM af_products a
  17. LEFT JOIN af_products_to_categories b ON b.pid=a.pid
  18. LEFT JOIN af_categories e ON e.catid=b.catid
  19. 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)
  20. AND manufacturers_id NOT LIKE '5432232' AND manufacturers_id NOT LIKE '3523537'
  21. GROUP BY a.pid
  22. HAVING Lagersaldo > 5
  23. ORDER BY kategorinamn, disable_se, Bild_finns_på_trademax DESC, artno ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement