« 简单总结一下各种开发语言的 if、 else if 的语法 | Main | awk 匹配 »
October 5, 2006
MSSQL 和 MySQL 取中间某几行的方法 sql语句
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。 https://windtear.net/archives/2006/10/05/001105.html http://windtear.net/archives/2006/10/05/001105.html MSSQL 和 MySQL 取中间某几行的方法 sql语句 取 MS SqlServer 第 100 行到第 200 行的数据 select * from student where s_id in (select top 100 s_id from student where s_id in (select top 200 s_id from dbo.student order by s_id) order by s_id desc) order by s_id 关键字: TOP n [PERCENT] SELECT 子查询 SET ROWCOUNT 取 MySQL 第 3 行到第 4 行的数据 mysql# select * from myns where name like 'windtear%' order by id limit 2,2; +----+-----------+ | id | name | +----+-----------+ | 3 | windtear3 | | 4 | windtear4 | +----+-----------+ 2 rows in set (0.01 sec) 关键字: limit |
Posted by windtear at October 5, 2006 11:53 PM