Funciones agregadas dentro de funciones agregadas en SQL

Problema SUM(CASE WHEN SUM(lg_oblg_entr_asnef) > 0 AND SUM(lg_oblg_entr_asnef) = SUM(lg_oblg_sal_asnef) THEN 0 WHEN(lg_oblg_entr_asnef) > 0 THEN 1 ELSE 0 END) AS lg_en_asnef; Mensaje: aggregate function calls may not have nested aggregate or window function Solución SELECT SUM(CASE WHEN sum_lg_oblg_entr_asnef > 0 AND sum_lg_oblg_entr_asnef = sum_lg_oblg_sal_asnef THEN 0WHEN sum_lg_oblg_entr_asnef > 0 THEN 1ELSE 0 END) AS […]

Leer más