mysql按指定顺序排序

2017-5-28 寒川 网页编程

直接上语句:

select * from tablename where id in(1,5,9,2,4) order by  find_in_set(id,'1,5,9,2,4');
select * from tablename where id in(1,5,9,2,4) order by substring_index('1,5,9,2,4',id,1);
select * from a tablename a in(1,5,9,2,4) order by field(id,1,5,9,2,4)

标签: mysql order 排序

评论(0) 浏览(4309)

Powered by emlog 蜀ICP备12030225号

川公网安备 51042102000001号

sitemap