如何以相反的顺序选择行(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)