mysql - Return query results in same order as the values in my `IN(....)` statement -


i need select users database "in" statement like:

select * users user_id in ("20,24,23,26,27,28,25") 

...this works need order (20,24,23,26,27,28,25) output. php orders ids desc or asc ... how can solve problem?

just use field() in order by clause

order field(user_id, 20, 24, 23, 26, 27, 28, 25) asc 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -