create table #t(作者 nvarchar(10) ,图书ID int,图书名称 nvarchar(10), 出版日期 nvarchar(10))
insert #t
select 'a',1,'xxxxx','2008-1' union all
select 'a',2,'xxxxx','2009-1' union all
select 'b',5,'xxxxx','2007-1' union all
select 'b',8,'xxxxx','2008-2' union all
select 'a',10,'xxxxx','2009-5' union all
select 'b',20,'xxxxx','2009-8'
go
---关键查询
select * from #t,(
select 作者,max(出版日期) as '出版日期'
from #t
group by 作者) s
where #t.作者=s.作者 and #t.出版日期=s.出版日期