declare @test table (单位编号 varChar(3),职工编号 VarChar(2),加入日期 datetime)
INSERT INTO @TEST(单位编号,职工编号,加入日期) VALUES('001','1','2002-05-02')
INSERT INTO @TEST(单位编号,职工编号,加入日期) VALUES('001','2','2003-04-01')
INSERT INTO @TEST(单位编号,职工编号,加入日期) VALUES('002','6','2001-02-15')
INSERT INTO @TEST(单位编号,职工编号,加入日期) VALUES('002','5','2000-12-03')
INSERT INTO @TEST(单位编号,职工编号,加入日期) VALUES('003','3','2003-04-02')
select * from @TEST tem where 加入日期=(select max(加入日期) from @TEST where 单位编号=tem.单位编号)
or
select * from @test x where 加入日期 in (select max(加入日期) from @test where x.单位编号=单位编号 )