Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
955 B
0
Indexable
Never
        SELECT 
            mb2.ordno AS no
            ,trim(oprd.prdno) AS prdno
            ,inv2.storeno AS loja
            ,trim(prd.name) AS name
            ,oprd.grade AS grade
            ,trim(oprd.qtty) AS qtd
            ,GROUP_CONCAT(trim(prdbar.barcode)) AS barcodes
        FROM sqldados.inv2
        INNER JOIN sqldados.iprd2 ON inv2.invno = iprd2.invno AND inv2.storeno = iprd2.storeno
        INNER JOIN sqldados.prd ON iprd2.prdno = prd.no
        INNER JOIN sqldados.mblistinv mb1 ON mb1.invno = inv2.invno
        INNER JOIN sqldados.mblistord mb2 ON mb1.groupno = mb2.groupno
        INNER JOIN sqldados.oprd ON iprd2.storeno = oprd.storeno AND iprd2.prdno = oprd.prdno
        LEFT JOIN sqldados.prdbar ON oprd.prdno = prdbar.prdno AND oprd.grade = prdbar.grade
        WHERE mb2.ordno = oprd.ordno
        AND inv2.nfname = :no
        AND inv2.storeno = :store
        GROUP BY mb2.ordno,oprd.prdno, oprd.grade;
Leave a Comment