MySQL之查询操作

1)使用in查询, 保持顺序

SELECT * FROM `template_data` where  template_id in (7339747298123169843,7339747324194799625,7339747298123153459);

使用Order by field(); 来保持顺序

SELECT * FROM `template_data` where template_id in (7339747298123169843,7339747324194799625,7339747298123153459) order by field(template_id, 7339747298123169843,7339747324194799625,7339747298123153459);

 

posted @ 2024-03-07 20:51  X-Wolf  阅读(9)  评论(0编辑  收藏  举报