问:
mysql中怎么按in语句中的id顺序取数据
select * from ecs_goods where goods_id in (14,1,33,23)
按14,1,33,23这个顺序取
答:
在程序中,$idList='14,1,33,23';
select * from ecs_goods where goods_id in ($idList) order by FIND_IN_SET(goods_id,'$idList')
转载请注明出处。