Buen dia comunidad, estoy tratando de obtener el valor de "0.00", pero me arroja "0"; alguna forma de obtener puesto que he intendado de muchas formas, incluso con IFF, pero no logro lo que deseo.
Comparto mi consulta:
select *,
iif( round((cast(NEU0_ as float) / cast(ANHO0_ as float)) * 100,2)>0,
round((cast(NEU0_ as float) / cast(ANHO0_ as float)) * 100,2), 0.00) as ANHO0AVANCE_,--aqui estuve intentando con IFF pero nada
iif( (cast(NEU1_ as float) / cast(ANHO1_ as float))>0,
round((cast(NEU1_ as float) / cast(ANHO1_ as float)) * 100,2), 0.00 ) as ANHO1AVANCE_,--aqui estuve intentando con IFF pero nada
round((cast(NEU2_ as float) / cast(ANHO2_ as float)) * 100,2) as ANHO2AVANCE_,
round((cast(NEU3_ as float) / cast(ANHO3_ as float)) * 100,2) as ANHO3AVANCE_,
round((cast(NEU4_ as float) / cast(ANHO4_ as float)) * 100,2) as ANHO4AVANCE_,
round((cast(NEU60_ as float) / cast(ANHO60_ as float)) * 100,2) as ANHO60AVANCE_
from
(
select desp.Provincia as PROVINCIA,
sum(desp.ANHO0) as ANHO0_,
sum(desp.NEU0) as NEU0_,
sum(desp.ANHO1) as ANHO1_,
sum(desp.NEU1) as NEU1_,
sum(desp.ANHO2) as ANHO2_,
sum(desp.NEU2) as NEU2_,
sum(desp.ANHO3) as ANHO3_,
sum(desp.NEU3) as NEU3_,
sum(desp.ANHO4) as ANHO4_,
sum(desp.NEU4) as NEU4_,
sum(desp.ANHO60) as ANHO60_,
sum(desp.NEU60) as NEU60_
from (
Select r.red, r.microrred, r.codeess_HISM, r.ubigeo, r.categoria, r.Provincia,r.Distrito,r.Establecimiento as eess,
anho0 as ANHO0,
anho1 as ANHO1,
anho2 as ANHO2,
anho3 as ANHO3,
anho4 as ANHO4,
anho60 as ANHO60,
SUM(CASE WHEN (ED >= 52 AND ED <= 61) AND(
(id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('2','D2')) OR (id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('2','D2')) OR(id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('2','D2')) OR(id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('2','D2')) OR(id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('2','D2')) OR
(id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('2','D2'))
)THEN 1 ELSE 0 END) 'NEU0',
SUM(CASE WHEN (ED =101) AND((id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('2','D2')) OR
(id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('2','D2')) OR (id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('2','D2')) OR (id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('2','D2')) OR (id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('2','D2')) OR (id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('2','D2'))
)THEN 1 ELSE 0 END) 'NEU1',
SUM(CASE WHEN ED=102 AND(
(id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('DU','DA','2','D2')) OR(id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('DU','DA','2','D2')) OR(id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('DU','DA','2','D2')) OR
(id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('DU','DA','2','D2')) OR(id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('DU','DA','2','D2')) OR(id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('DU','DA','2','D2'))
)THEN 1 ELSE 0 END) 'NEU2',
SUM(CASE WHEN ED=103 AND(
(id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('DU','DA','2','D2','')) OR(id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('DU','DA','2','D2','')) OR(id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('DU','DA','2','D2','')) OR
(id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('DU','DA','2','D2','')) OR(id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('DU','DA','2','D2','')) OR(id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('DU','DA','2','D2',''))
)THEN 1 ELSE 0 END) 'NEU3',
SUM(CASE WHEN ED=104 AND(
(id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('DU','DA','2','D2','')) OR(id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('DU','DA','2','D2','')) OR(id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('DU','DA','2','D2','')) OR
(id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('DU','DA','2','D2','')) OR(id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('DU','DA','2','D2','')) OR(id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('DU','DA','2','D2',''))
)THEN 1 ELSE 0 END) 'NEU4',
SUM(CASE WHEN ED>=160 AND(
(id_ciex1='90670' and id_tipdiag1 in ('D') and ISNULL(valor_lab1,'') in ('1','DU','DA','')) OR(id_ciex2='90670' and id_tipdiag2 in ('D') and ISNULL(valor_lab2,'') in ('1','DU','DA','')) OR(id_ciex3='90670' and id_tipdiag3 in ('D') and ISNULL(valor_lab3,'') in ('1','DU','DA','')) OR
(id_ciex4='90670' and id_tipdiag4 in ('D') and ISNULL(valor_lab4,'') in ('1','DU','DA','')) OR(id_ciex5='90670' and id_tipdiag5 in ('D') and ISNULL(valor_lab5,'') in ('1','DU','DA','')) OR(id_ciex6='90670' and id_tipdiag6 in ('D') and ISNULL(valor_lab6,'') in ('1','DU','DA',''))
)THEN 1 ELSE 0 END) 'NEU60'
from BDRISLAB.DBO.ARCHIVOPLANO h
INNER JOIN BDHISMINSA.dbo.RENIPRESS2 R ON (CONVERT(INT,H.RENAES)=CONVERT(INT, R.codeess_HISM))
INNER JOIN BDRISLAB.dbo.M_NEU d ON (CONVERT(INT, d.renaes)=CONVERT(INT, r.codeess_HISM))
group by r.red, r.microrred, r.codeess_HISM, r.ubigeo, r.categoria,r.Provincia,r.Distrito,r.Establecimiento,d.anho0, d.anho1, d.anho2, d.anho3, d.anho4, d.anho60
)desp
group by desp.Provincia)desp2