0

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)
Mario7
  • 83
  • 1
  • 12

1 Answers1

0

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:

mysql> select remove_repeats( (select * from rt order by gid asc),gid,0,10);
+------+------+
| id   | gid  |
+------+------+
|    1 |   11 |
|    2 |   22 |
|    3 |   33 |
+------+------+
3 rows in set (0.00 sec)
Manticore Search
  • 1,462
  • 9
  • 9