开发者

How to get the next record in a MySQL table with multiple sort values

Suppose I had a table with 5 fields or so and I wanted the next record but I want it to be the next one as if the records were ordered by 3 of the fields, as seen 开发者_运维知识库in the MySQL statement below:

SELECT id FROM t1 ORDERBY f1 ASC, f2 ASC, f3 ASC;

Is there a way to do this?


Found a solution: By using Concat_ws of the two fields in both the WHERE (to select the next one) and the ORDER BY Clauses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜