select userID from user a left outer join(select min(checkper) as checkper,role_id,dept_id from role group by dept_id,role_id) b on a.role_id=b.rold_id and a.dept_id=b.deptid
SELECT tr.checkper,tu.user_id,tr.dept_id
FROM Tuser tu
RIGHT JOIN role tr ON tr.rloe_id=tu.role_id
WHERE checkper=(SELECT MIN(checkper) FROM role)