from http://database.51cto.com/art/201011/235100.htm
先创建一个行号函数:
CREATE FUNCTION rno ()
RETURNS INT
BEGIN
SET @rno = @rno + 1;
RETURN @rno;
END;
使用行号函数:
mysql> SET @rno = 0;
mysql> SELECT rno(),s1,s2 FROM t;
2022-01-07 08:53:23
from http://database.51cto.com/art/201011/235100.htm
先创建一个行号函数:
CREATE FUNCTION rno ()
RETURNS INT
BEGIN
SET @rno = @rno + 1;
RETURN @rno;
END;
使用行号函数:
mysql> SET @rno = 0;
mysql> SELECT rno(),s1,s2 FROM t;