mysql中in查询条件的时候,很多时候排序是不规则的,如何按照in里面的条件进行排序呢?

mysql中给出了办法,在in后面加order by field,order by field的首个条件是按照哪个字段排序,然后把in里面的条件复制进去,就可以排序了,希望可以帮助大家!

select * from service_type st where st.id in (5,9,7,10,8) order by field(id,5,9,7,10,8)

相关文章:

  • 2022-12-23
  • 2022-01-04
  • 2022-01-10
  • 2021-11-18
  • 2021-12-14
  • 2021-07-18
  • 2021-07-30
  • 2022-02-14
猜你喜欢
  • 2021-12-09
  • 2022-01-27
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2022-01-07
相关资源
相似解决方案