1.
select distinct first_value(emp_id) over(partition by emp_code order by tm.last_modify_tm desc) from employee tm
2.
select * from (select max(t.created_tm) as maxid,emp_code from EMPLOYEE t where t.valid_flg = 1 group by t.emp_code) mte left join EMPLOYEE te on (mte.maxid=te.created_tm and mte.emp_code=te.emp_code)