I barely understood what you mean. There's no RowNumber()
function in mysql, and partitioning has nothing to do with your request.
It's:
SELECT
t.*,
@cur:= IF(id=@id, @cur+1, 1) AS RowNumber,
@id := id
FROM
t CROSS JOIN
(SELECT @id:=(SELECT MIN(id) FROM t), @cur:=0) AS init
ORDER BY
t.id
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…