dimanche 21 septembre 2014

Need to calculate the difference through the values return from decode


Vote count:

0




select T2.WFID, DECODE(T2.Status ,'Pending',Count(T1.CID)) as id, DECODE(T2.Status ,'Pending',sum(case when T1.Module='Dataform' then 1 else 0 end)) as D, DECODE(T2.Status ,'Pending',sum(case when T1.EL_Module='Community' then 1 else 0 end)) as C, DECODE(T2.Status ,'Approved',Count(T1.CID)) as Nid, DECODE(T2.Status ,'Approved',sum(case when T1.Module='Dataform' then 1 else 0 end)) as ND, DECODE(T2.Status ,'Approved',sum(case when T1.Module='Community' then 1 else 0 end)) as Nc, from DATA_FORM1 T1,DATA_FORM2 T2 where T2.CId=T1.CID(+) and nvl(T2.archive_flag,0) in (0,3) group by T1.ID,T2.WID,T2.Module


I need to calculate the diffrence of below columns id-Nd,D-ND,C-ND when the status is Approved using decode in same query



asked 15 secs ago







Need to calculate the difference through the values return from decode

Aucun commentaire:

Enregistrer un commentaire