促销方案商品列表.sql 1.1 KB

1234567891011121314151617181920212223242526272829
  1. SELECT t1.itemid,
  2. t1.itemno,
  3. t1.itemname,
  4. t1.model,
  5. t1.batchcontrol,
  6. t1.orderminqty_auxunit,
  7. t3.orderminqty,
  8. t1.orderaddqty_auxunit,
  9. t3.orderaddqty,
  10. t3.groupqty,
  11. t1.spec,
  12. t1.marketprice,
  13. (SELECT unitname FROM plm_unit WHERE unitid = t1.unitid and siteid = t1.siteid) unit,
  14. (SELECT unitname FROM plm_unit WHERE unitid = t2.auxunitid and siteid = t1.siteid) auxunit,
  15. t2.conversionrate,
  16. t5.oldprice,
  17. t5.pricegrade,
  18. t5.price
  19. from plm_item t1
  20. LEFT JOIN plm_unitgroup t2 ON t2.unitgroupid = t1.unitgroupid and t2.siteid = t1.siteid
  21. LEFT JOIN sa_promotion_items t3 ON t3.itemid = t1.itemid and t3.siteid = t1.siteid
  22. LEFT JOIN sa_promotion_itemprice t5
  23. ON t5.itemid = t3.itemid and t5.siteid = t3.siteid and t5.sa_promotionid = t3.sa_promotionid
  24. LEFT JOIN sys_enterprise t6 ON t6.grade = t5.pricegrade and t6.siteid = t5.siteid
  25. WHERE t1.siteid = $siteid$
  26. and t1.status = '审核'
  27. and t3.sa_promotionid = $sa_promotionid$
  28. and t6.sys_enterpriseid = $sys_enterpriseid$
  29. and $where$