在MySQL中处理整个语句后选择特定行

时间:2014-10-26 13:49:19

标签: mysql

以下是我的示例结果:

+------+-----------------+--------+
| rank | nick            | amount |
+------+-----------------+--------+
|    1 | 038112125147518 | 0.2000 |
|    2 | 0tosan          | 0.2000 |
|    3 | 13unnyeater     | 0.2000 |
+------+-----------------+--------+

SET / SELECT语句返回的内容:

SET @rank=0; SELECT @rank:=@rank+1 AS rank, nick, amount FROM points;

返回行匹配的最有效方法是什么:

nick='13unnyeater'

...'rank'栏后用上面的表格列表?我期望的结果是:

+------+-----------------+--------+
| rank | nick            | amount |
+------+-----------------+--------+
|    3 | 13unnyeater     | 0.2000 |
+------+-----------------+--------+

0 个答案:

没有答案