Last active
June 24, 2017 04:54
-
-
Save BrunoDSouza/c8389e2312f339d074708cd28b241d78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select m.COD_PRODUTO, | |
p.DESCRICAO, | |
sum(m.QTD_ITENS) as Qtd , | |
(sum(m.QTD_ITENS) * 100 / (select sum(m2.QTD_ITENS) from movimentacoes as m2)) as Percentual | |
from movimentacoes as m | |
join produto as p | |
on p.idproduto = m.cod_produto | |
where m.cod_tipomovimento = 1 | |
group by m.COD_PRODUTO, p.descricao | |
order by Percentual desc | |
limit 10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment