Select 查询 自增序列生成

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

你可能感兴趣的:(开发)