开发者

MySQL ordering by a nextid column

I'm trying to pull some info out of a Moodle database.

There is one part that has a list of questions that you can order in whatever way you want through t开发者_StackOverflowhe Moodle interface.

However, the way it stores this in the database is making it hard for me to make a custom query that orders these items in the same manner outside of the moodle interface.

So there is a column ID, then a column NEXTPAGEID.

Here are the first 5 rows in the SQL to give you an example of what I need:

ID: 1; NEXTPAGEID: 3

ID: 3; NEXTPAGEID: 118

ID: 9; NEXTPAGEID: 10

ID: 10; NEXTPAGEID: 515

ID: 11; NEXTPAGEID: 12

So the order I really need is ID: 1, 3, 118, (whatever the NEXTPAGEID of 118 is), etc.

So is this possible in SQL or do I have to deal with it in the PHP when I output this query?


No, you can't. You'll have to do it in PHP.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜