select applyervocation,contractamount,applyerage,max(historyoverduedays) from T_CASE
group by applyervocation,contractamount,applyerage
having max(historyoverduedays>30你试试看
group by applyervocation,contractamount,applyerage
having max(historyoverduedays>30你试试看
sum(case when historyoverduedays>30 then 1 end) "逾期超过超过30天",
sum(case when historyoverduedays<=30 then 1 end) "逾期未超过超过30天"
from T_CASE
group by applyervocation,contractamount,applyerage