create table T(pid int, s_name varchar(10), s_mem varchar(10))
insert T select 1, '程序员', 'A单位'
union all select 2, '清洁工', 'A单位'
union all select 3, '程序员', 'B单位'
union all select 4, '经理', 'A单位'
union all select 5, '财务', 'C单位'
union all select 6, '工程员', 'A单位'
set rowcount 10
select * from T as tmp
where not exists(select 1 from T where s_mem=tmp.s_mem and pid>tmp.pid)
order by pid desc
set rowcount 0