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;
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;