Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as SQL by registered user vvillacorta ( 3 years ago )
SELECT A.FECPROCESO,  TRIM(A.CODDOC) NUMRUC, 
    SUM(MONTODEUDA)  monto_deuda_tributo_amt,
    MIN(FECINICIOPROCESO)  FECINICIOPROCESOTRIBUTO,
    CASE WHEN MAX(FECINICIOPROCESO) IS NULL THEN 0
                 ELSE MONTHS_BETWEEN(CAST(FECPROCESO AS DATE FORMAT 'YYYYMM'),CAST(MIN(FECINICIOPROCESO) AS DATE FORMAT 'YYYYMM')) / 12 
                 END tiempo_deuda_tributaria_amt,
    CASE WHEN SUM(MONTODEUDA) = 0 THEN 0 ELSE COUNT(CODDOC) END cnt_deudas_tributarias
    FROM .....................V_TRIBUTOS_SUNAT_HIST A
    WHERE 1 = 1
    AND ESTADO = 0
    GROUP BY A.FECPROCESO,  TRIM(A.CODDOC)

 

Revise this Paste

Your Name: Code Language: