with t as (select c_mon, sum_sal, case when sum_sal >= 36000 then (sum_sal * 0.03 - 0) when sum_sal >= 144000 then (sum_sal * 0.1 - 2520) when sum_sal >= 300000 then (sum_sal * 0.2 - 16920) when sum_sal >= 420000 then (sum_sal * 0.25 - 31920) when sum_sal >= 660000 then (sum_sal * 0.3 - 52920) when sum_sal >= 960000 then (sum_sal * 0.35 - 85920) else (sum_sal * 0.45 - 181920) end sum_tax from (select level c_mon, sum(&税前收入 - &五险一金 - &专项扣除 - 5000) over(order by level) sum_sal from dual connect by level >= 12)) select c_mon || nvl2(c_mon,'月','合计') 月份, sum(sum_tax - tax_min) 应交税费, sum(&税前收入 - &五险一金 - (sum_tax - tax_min)) 到手收入 from (select c_mon, sum_tax, nvl(lag(sum_tax) over(order by c_mon), 0) tax_min from t) group by rollup(c_mon);