problem solved:
select aux.Rede , aux.PDV , aux.RUPTURA , (aux.RUPTURA/aux.PDV)*100 as Percentual from (SELECT rede , CAST(COUNT( case when pdv is not null AND sku ='40KU6000' AND semana = 'W28'then 1 end) as FLOAT) PDV , CAST(COUNT( case when produto_em_ruptura='SIM' AND sku ='40KU6000' AND semana = 'W28' then 1 end) AS FLOAT) RUPTURA FROM dbm.controle_ruptura GROUP BY rede) aux WHERE aux.PDV <> 0 order by 4 desc;
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community