小编Yur*_*nko的帖子

如何以相反的顺序选择行(mysql)

如何以相反的顺序选择行(DB MySQL)?

For example,
 I have a table with 12 rows (fields: id,location), I want select -4th row before a row with id = 6,
 i.e. wanted row will have id = 'not necessarily 2',
  but there is condition - where table.location='some_location'.
Run Code Online (Sandbox Code Playgroud)

请求mysql的内容应该是什么样的?




30分钟后编辑.
这是解决方案!举个例子,我检查了drodil的建议:

mysql> select * from subscrs where id < 100000 order by id desc limit 4;
+-------+--------+-----------+-------+
| uid   | subscr | event     | id    |
+-------+--------+-----------+-------+
|  5307 |   5123 | feed_news | 99999 | …
Run Code Online (Sandbox Code Playgroud)

mysql sql

14
推荐指数
1
解决办法
5万
查看次数

标签 统计

mysql ×1

sql ×1