select ROW_NUMBER() over(order by b.userid)-1 num from UsersInfo,UsersInfo b 转载于:https://www.cnblogs.com/andy_tigger/archive/2011/03/08/1977048.html