ms Sqlserver:使用默认函数ROW_NUMBER()
SELECT ROW_NUMBER()OVER (ORDER BY SID DESC) AS ROW, location FROM table where Kind >=4
mySql :没有函数,只能使用变量
set @n = 0;
select (@n := @n + 1) as id , location from table where Kind >=4
本文介绍了在MsSqlserver中使用ROW_NUMBER()函数实现简单分页的方法,并对比了mySql环境下通过设置变量来达到相同目的的不同实现方式。
ms Sqlserver:使用默认函数ROW_NUMBER()
SELECT ROW_NUMBER()OVER (ORDER BY SID DESC) AS ROW, location FROM table where Kind >=4
mySql :没有函数,只能使用变量
set @n = 0;
select (@n := @n + 1) as id , location from table where Kind >=4

被折叠的 条评论
为什么被折叠?