Untitled
unknown
plain_text
2 years ago
723 B
13
Indexable
SELECT
stk.prdno AS Codigo,
stk.grade AS Grade,
(ROUND(((stk.qtty_varejo+stk.qtty_atacado) / 1000),0) - IFNULL(ROUND(((devf.qtty_varejo+devf.qtty_atacado) / 1000),0),0)) AS qtd
FROM sqldados.stk
INNER JOIN sqldados.prd ON stk.prdno = prd.no
LEFT JOIN sqldados.devf ON stk.storeno = devf.storeno AND stk.prdno = devf.prdno AND stk.grade = devf.grade
WHERE stk.storeno = :store
AND stk.prdno = :productCode
AND stk.grade LIKE CONCAT(:grade , '%')
AND stk.qtty_varejo+stk.qtty_atacado > 0
GROUP BY stk.storeno,stk.prdno,stk.grade
HAVING qtd > 0;Editor is loading...
Leave a Comment