MySQL 查询in操作,查询结果按in集合顺序显示
复制代码 代码如下:
select * from test where id in(3,1,5) order by find_in_set(id,’3,1,5′);
select * from test where id in(3,1,5) order by substring_index(‘3,1,2’,id,1);
MySQL 查询in操作,查询结果按in集合顺序显示
复制代码 代码如下:
select * from test where id in(3,1,5) order by find_in_set(id,’3,1,5′);
select * from test where id in(3,1,5) order by substring_index(‘3,1,2’,id,1);