–update t_datanum set reg_dt = now() where reg_dt < now() – interval ‘1 hour’;
update
t_datanum
set
— reg_dt = (case when reg_dt < now() – interval ‘1 hour’ then date_trunc(‘hour’, now()) else reg_dt end),
reg_dt = (case when reg_dt < now() – interval ‘1 hour’ then now() else reg_dt end),
count = (case when reg_dt < now() – interval ‘1 hour’ then 0 else count + 1 end)
;
–update t_datanum set count = count + 1 where reg_dt >= now() – interval ‘1 hour’;
select * from t_datanum ;