このようなものはどうですか?
SELECT
(CASE WHEN @date <> date THEN @row := @row +1 ELSE @row END) AS rownum,
@date:= date,
date
FROM ( SELECT @row := 0, @date := NOW() ) r, stats
このようなものはどうですか?
SELECT
(CASE WHEN @date <> date THEN @row := @row +1 ELSE @row END) AS rownum,
@date:= date,
date
FROM ( SELECT @row := 0, @date := NOW() ) r, stats