the document said REMOVE_REPEATS ( result_set, column, offset, limit ) - removes repeated adjusted rows with the same 'column' value. but when I run select remove_repeats((select * from rt), gid, 0, 10), The record gid=22 appeared twice.Shouldn't it appear only once?
mysql> select remove_repeats( (select * from rt),gid,0,10);
+------+------+
| id | gid |
+------+------+
| 1 | 11 |
| 2 | 22 |
| 3 | 33 |
| 4 | 22 |
+------+------+
4 rows in set (0.00 sec)
REMOVE_REPEATS() removes only repeated rows going one by another. In your case you can remove the 2nd occurrence of gid=22 if you order the sub-query by gid: