Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @acum:= @acum + count(mtg.idTemaGestion) as acumulado
- count(mtg.idTemaGestion)
- join (SELECT @acum:= 0) r
- set @acum:= 0;
- SELECT *, round((c.acumulado / total), 2) as pareto
- from (
- SELECT tg.detTipoGestion, mtg.detTemaGestion,
- (SELECT sum(total) from totalParaCalcular) as total,
- count(mtg.idTemaGestion) as totalRegistros,
- @acum:= @acum + count(mtg.idTemaGestion) as acumulado
- from mac_gestion mg
- inner join mac360_mac_gestion mmg on mg.idMacGestion = mmg.idMacGestion_FK
- inner join mac360 m on m.idMac360 = mmg.idMac360_FK
- inner join mac_tipogestion tg on tg.idTipoGestion = mg.idTipoGestion_FK
- inner join datos_nomina dn on dn.idDatosNomina = m.idDatosNominaRecibe_FK
- inner join site si on si.idSite = dn.idSite_FK
- inner join cuenta_proceso_celula cpc on cpc.idCuentaProcesoCelula =
- dn.idCuentaProcesoCelula_FK
- inner join cuenta cu on cu.idCuenta = cpc.idCuenta_FK
- inner join proceso pro on pro.idProceso = cpc.idProceso_FK
- inner join celula ce on ce.idCelula = cpc.idCelula_FK
- inner join mac_temagestion mtg on mtg.idTemaGestion = mg.idTemaGestion_FK
- join (SELECT @acum:= 0) r
- where mg.error = 'si'
- and si.idSIte in (2)
- and cu.idCuenta in (2)
- and pro.idProceso in (25)
- and ce.idCelula in (12)
- and tg.idTipoGestion in (1)
- group by mtg.detTemaGestion
- order by count(mtg.idTemaGestion) desc
- ) c
- WHERE C.ACUMULADO/Total <= 0.80;
Add Comment
Please, Sign In to add comment