select applyervocation,contractamount,applyerage,max(historyoverduedays) from T_CASE 
group by applyervocation,contractamount,applyerage
having max(historyoverduedays>30你试试看