Jump to content

[SOLVED] Order records by value not field


gijew

Recommended Posts

So I'm trying to figure out the easiest / best way to do this and I think I'm over complicating this so I need help here.

I'm pulling records from a table using the RAND() function.  I soon realized when the user submitting the form it would randomize the record set again unless I specifically told it to chose the records from the first query.  I have that working BUT I'm getting stuck on the ORDER BY part of it all which I didn't think about.

A query would look like this:
SELECT question_id, question FROM certification_questions WHERE question_id IN (3,4,1)

If I tried to order them by record 3,4,1 I get a mySQL error because well, you can't order by the field value, just the field (at least from what I know) SO I'm kind of lost on how to order the records by 3,4,1.

Any insight here on how best to accomplish this?
Link to comment
https://forums.phpfreaks.com/topic/32188-solved-order-records-by-value-not-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.