使用IN()选择查询,不进行任何排序

use*_*933 9 mysql sql sorting sql-order-by

我的查询

select * from product where productId in(25,36,40,1,50);
Run Code Online (Sandbox Code Playgroud)

结果如下

`productId   ProductName  Qty Price`
-------------------------------------
`1          | namesome  | 5 | 25.00`
`25         | namesome  | 5 | 35.00`
`36         | namesome  | 5 | 35.00`
`40         | namesome  | 5 | 35.00`
`50         | namesome  | 5 | 35.00`
Run Code Online (Sandbox Code Playgroud)

我没有使用任何order by子句,但它自动应用的顺序productId,
我需要任何类型的结果,如下所示

`productId   ProductName  Qty Price`
-------------------------------------
`25        | namesome  | 5 | 25.00`
`36        | namesome  | 5 | 35.00`
`40        | namesome  | 5 | 35.00`
`1         | namesome  | 5 | 35.00`
`50        | namesome  | 5 | 35.00`
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?
数据库引擎:MyIsam,排序:utf8_general_ci,PrimaryKey onproductId

Han*_*nky 13

select * 
from product 
where productId in(25,36,40,1,50) 
order by find_in_set(productId, '25,36,40,1,50');
Run Code Online (Sandbox Code Playgroud)

看到这个SQLFiddle