您的位置:首页 > 数据库

查询ID第五条至第十五条记录(SQL server2000)

2007-06-13 23:12 190 查看


select top 15 * from authors order by au_id

select IDENTITY(int,1,1) as iid,* into #temptable from authors select top 11 * from #temptable where iid>=5
--第五条至第十五条是共是11条

select * from #temptable

drop table #temptable -- 实际执行时候,删除全部临时表当然不再这里执行

--SELECT top 5 * FROM authors WHERE au_id not in (SELECT top 15 au_id FROM authors)

--select top 10 * from authors where au_id not in
--( select top 10 au_id from authors order by au_id) order by au_id
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐