UPDATE
loan_overdue_list l set
l.type_status=(
CASE
WHEN l.overdue_days>(select c.overdue_one from loan_config c where c.gems_fs_id=l.gems_fs_id) THEN 11
WHEN l.overdue_days>(select c.overdue_two from loan_config c where c.gems_fs_id=l.gems_fs_id) THEN 12
WHEN l.overdue_days>(select c.overdue_three from loan_config c where c.gems_fs_id=l.gems_fs_id) THEN 13
ELSE l.type_status
END
)
,l.overdue_days=l.overdue_days+1
where
l.overdue_amount>0 and l.type_id=1