1.获取job表中多条记录中的最新的一条记录
/*Dialect*/select a.*
from job a
where not exists(select 1
from job b
where b.deptcode=a.deptcode and b.stime>a.stime)
and a.ismaster=1 and a.deptcode in ('DP0205','DP41','DP5600')
order by stime desc;
2、执行job表中最新表的状态值,可重新同步数据
update job set synstatus=0 where id in (select a.id
from job a
where not exists(select 1
from job b
where b.deptcode=a.deptcode and b.stime>a.stime)
and a.ismaster=1 and a.deptcode in ('DP0205','DP41','DP5600'))