select top 10 * from (select top 40 * from a order by id asc
select top 10 * from (select top 40 * from a order by id asc) top_n order by id desc
以上这句是你写的,取出表A中第31到第40记录(SQLServer2005,以自动增长的ID作为主键,注意:ID可能不是连续的.)
我想问下能不能将这段代码给讲解下.select top 40是查询前40条数据吧.那么括号外的select top 10是查询40条数据里的前10条.那不是和题目的意思不同了嘛.但我放到数据库里是能查到的.请讲解下,