select id,title from za_item where -- 
id in (1003,1000)

返回的结果第一条是对应id是1000,第二条是1003。

如果我们想让结果和in里面的排序一致,可以这么做。

select id,title from za_item where
id in (1003,1000)
order by field(id,1003,1000);

或者

select id,title from za_item where
id in (1003,1000)
order by find_in_set(id,'1003 ,1000') 

 

相关文章:

  • 2021-09-13
  • 2022-12-23
  • 2021-08-19
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
猜你喜欢
  • 2021-12-01
  • 2021-04-11
  • 2022-01-10
  • 2021-11-28
  • 2022-01-27
  • 2021-07-03
  • 2021-06-23
相关资源
相似解决方案