请问:读出满足一个条件的(任意)第m条记录到第n条记录(没有分了^_^) select * from t1 where userId >1------------------为了取出第m条到第n条记录,请问怎么样把这个语句写完整 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 加上標示列,where id between m and n就可以了 select * from sysobjects a where (select id from sysobjects where id=a.id) between 1 and 9试试看这个 是不是有误解??我说的是满足where条件里面的第m条到第n条.可是你们说的是从第m条到第n条里面去按条件取数据 SELECT TOP n-m+1 * FROM Table WHERE (id NOT IN (SELECT TOP m-1 id FROM Table )) 我是sqlserver2000,楼上的id是什么啊,是一个字段名吗?我的表里面没有id这个字段啊 SELECT TOP n-m+1 * FROM Table WHERE (id NOT IN (SELECT TOP m-1 id FROM Table )) table 就是你的数据表id 就是你表主键 --取8.9.10三行记录的方法,前提,编号是主键才行select top 3 *from gzda awhere 编号 in (select top 7 编号 from gzda order by 编号 desc)order by 编号 desc select identity(int ,1,1) as id, * into #a from authorsselect * from #a where id between 10 and 19drop table #a select identity(int ,1,1) as id, * into #a from authorsselect top 10 * from #a where id not in(select top 9 id from #a)drop table #a 合计问题 关于一句SQL的请教 SQL脚本是什么DD呀!!!那位GGJJ告诉我!!! sql2005中建的表不显示 NULL如何select 关于convert()函数的使用。 触发器第一次不执行??? 初学,问一简单问题,数据库的时间段查询? delete和truncate table区别! 急:数据库恢复问题 ######## 如何获取一个已有视图的SQL语句? ########## 简单!!求一模糊查询!不是高手也可以帮忙看下!
我说的是满足where条件里面的第m条到第n条.
可是你们说的是从第m条到第n条里面去按条件取数据
FROM Table
WHERE (id NOT IN (SELECT TOP m-1 id FROM Table ))
楼上的id是什么啊,是一个字段名吗?我的表里面没有id这个字段啊
FROM Table
WHERE (id NOT IN (SELECT TOP m-1 id FROM Table ))
table 就是你的数据表
id 就是你表主键
from gzda a
where 编号 in (select top 7 编号 from gzda order by 编号 desc)
order by 编号 desc
select identity(int ,1,1) as id, * into #a from authors
select * from #a where id between 10 and 19
drop table #a
select top 10 * from #a where id not in(select top 9 id from #a)
drop table #a