以下是我的查询的当前输出:SELECT vans,icollaborate_id FROM mytable;
+==========+=====================+
| vans | icollaborate_id |
+==========+=====================+
| sachin | 10 |
| cricket | 10 |
| chess | 10 |
| male | 11 |
| 31-40 | 11 |
| sachin | 11 |
| female | 12 |
| tennis | 12 |
| 21-30 | 12 |
+----------+---------------------+
现在我想生成一个返回相同输出但有限制的结果。例如,如果用户指定limit=2
,则输出应如下所示:
限制为 2 的预期输出
+==========+=====================+
| vans | icollaborate_id |
+==========+=====================+
| sachin | 10 |
| cricket | 10 |
| chess | 10 |
| male | 11 |
| 31-40 | 11 |
| sachin | 11 |
+----------+---------------------+
限制为 3 的预期输出
+==========+=====================+
| vans | icollaborate_id |
+==========+=====================+
| sachin | 10 |
| cricket | 10 |
| chess | 10 |
| male | 11 |
| 31-40 | 11 |
| sachin | 11 |
| female | 12 |
| tennis | 12 |
| 21-30 | 12 |
+----------+---------------------+
请指教。