sql in查询排序

1.默认下,使用select xxx where in(xx,xx)查询,返回结果是按主键排序的,如果要按in()中值的排列顺序,可以这样做:
 
select * from talbe where id in(3,2,4,1) ORDER BY FIND_IN_SET( id, '3,2,4,1') 
本文转自http://blog.chinaunix.net/uid-20304312-id-1707798.html 感谢作者
posted @ 2016-12-16 21:16  跨境电商杂货铺  阅读(1988)  评论(0编辑  收藏  举报