这有什么问题
select
ID
,SYSCODE
,LID
,ROW_NUMBER() OVER(PARTITION BY ID ORDER BY SYSCODE, LID) AS row_num
from prod_sys.P_ENTERPRISE
它可以在Management Studio中工作,但不能在mysql工作台中工作
答案 0 :(得分:0)
MYSQL中没有ROW_NUMBER(),请按如下所示重写查询。
select
ID
,SYSCODE
,LID
,@row_num := @row_num + 1 as Row_number
from prod_sys.P_ENTERPRISE join (SELECT @row_num := 0) a;