剑客星云-- 海 风
--------------------寻觅自己的天空
本例数据库表:Nodes(id,name,level)
如果要取出数据库中第N大的数据记录,则可以这样写SQL语句:
select * from nodes where id=(select Min(id) as id from nodes where id in(select top N id from nodes order by id Desc))
注意:此处N是你选取的第几大的数据记录
同理:第N小的数据记录的SQL语句
select * from nodes where id=(select Max(id) as id from nodes where id in(select top N id from nodes order by id asc))


posted on 2006-03-07 17:34  海风  阅读(165)  评论(0)    收藏  举报