查询可添加商品列表.sql 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. SELECT t1.itemid,
  2. t1.itemno,
  3. t1.itemname,
  4. t1.model,
  5. t1.batchcontrol,
  6. t1.orderminqty_auxunit,
  7. t1.orderminqty,
  8. t1.orderaddqty_auxunit,
  9. t1.orderaddqty,
  10. t1.spec,
  11. t1.standards,
  12. t1.marketprice,
  13. t4.unitname unit,
  14. t5.unitname auxunit,
  15. t2.conversionrate,
  16. t3.material,
  17. t3.erpitemno,
  18. t3.erpitemname,
  19. t3.specalnote,
  20. t3.prodline,
  21. t3.device
  22. from plm_item t1
  23. LEFT JOIN plm_unitgroup t2 ON t2.unitgroupid = t1.unitgroupid and t2.siteid = t1.siteid
  24. left join plm_itemextend t3 on t3.itemid = t1.itemid and t3.siteid = t1.siteid
  25. LEFT JOIN plm_unit t4 ON t4.unitid = t1.unitid AND t4.siteid = t1.siteid
  26. LEFT JOIN plm_unit t5 ON t5.unitid = t2.auxunitid AND t5.siteid = t2.siteid
  27. WHERE t1.siteid = $siteid$
  28. and t1.status = '审核'
  29. and t1.isonsale = 1
  30. and t1.istool = 0
  31. and $where$
  32. and t1.itemid in (SELECT itemid from plm_item_tradefield WHERE siteid = $siteid$ and tradefield = $tradefield$)
  33. and t1.itemid in (SELECT t1.itemid
  34. from sa_itemsaleclass t1
  35. INNER JOIN plm_itemclass t2 ON t1.itemclassid = t2.itemclassid and t1.siteid = t2.siteid
  36. WHERE t1.siteid = $siteid$
  37. and t2.sa_brandid = $sa_brandid$
  38. and $where2$)