Link to home
Start Free TrialLog in
Avatar of Cornelia Yoder
Cornelia YoderFlag for United States of America

asked on

MySQL order by List

Is there any way to give a sort order by list in MySQL?

Something like
SELECT * FROM Table ORDER BY Id=(2,4,3,1,5)
effectively sorting the results in that order of ID value?
Avatar of rawinnlnx9
rawinnlnx9
Flag of United States of America image

Select * From Table ORDER BY Table.ID ASCENDING
SOLUTION
Avatar of rawinnlnx9
rawinnlnx9
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cornelia Yoder

ASKER

Thanks, guys!
I guess I don't get why I was assisted. I linked to the exact same answer the person after me gave. Just because I dind't copy and paste it I'm "assisted"? That doesn't strike me as assisted.
The answers were essentially the same, at approximately the same time.  I split the points evenly.  Is there some advantage to being the Accepted vs Assisted answer?