擦,搞定了,分享下
--11.1取出这个表中的最后n条数据,并按倒序输出...
Sql语句:
select top 3 * from[表名] where id not in(select id from[表名] where id<=((select count(*) from [表名])-n)) order by [字段名] desc
--11.2取出这个表中的中间n条数据的前m条,并按倒序输出...先取出在排序。
select * from [表名]
where id in
{
select top m * from[表名] where id not in(select id from[表名] where id<=((select count(*) from [表名])-n))
)
order by [字段名] desc
--11.3取出这个表中的中间n条数据的前m条,并按倒序输出...先排序在取出
select top m * from[表名] where id not in(select id from[表名] where id<=((select count(*) from [表名])-n)) order by [字段名] desc |