題目很簡單,顯示aname中重復的第一行
答案應當如此(調試通過)
select (select top 1 id from aa as b where b.aname=c.aname) as id,aname from (select distinct aname from aa) c
另外出第m行到第n行數據的題也比較常見
不過應當注意是否包含第m行,如果包含第m行,則應該(還是針對上面的表):
select * from(select top (n-m+1)* from (select top (n)* from aa order by id)f order by id desc) h order by id