求一个简单的SQL语句
一共有100条记录,我想选第50条到第60条的纪录怎么写
问题点数:20、回复次数:4Top
1 楼xluzhong(Ralph)回复于 2005-03-02 09:56:03 得分 0
table1(col1 int,col2 varchar(100))
1:如果table1中没有唯一值得列
临时给table1加上一个identity列,查询完后再drop掉
alter table table1 add NewID int identity(1,1)
select col1,col2 from table1 where NewID>=50 and NewID<=60
alter table table1 drop column NewID
2.如果table1中col1的值唯一,也可以如下
select top 60 * from table1 where col1 not in (select top 50 col1 from table1)Top
2 楼flashasp(flashasp)回复于 2005-03-02 10:04:12 得分 20
SELECT TOP 50 a.num, a.name
FROM (SELECT TOP 60 *
FROM stu
ORDER BY num DESC) a
ORDER BY a.numTop
3 楼wyb0026(小小)回复于 2005-03-02 10:13:25 得分 0
SELECT TOP 这个咚咚选定的是确定值 也就是第一次和第二次结果不不见得一样 top 不是首选还是从表结构在想象办法吧Top
4 楼flybox728(淮予)回复于 2005-03-02 10:16:51 得分 0
用存储过程,写游标,产生临时表Top




