1、一般的order by 语句其返回的结果为

SELECT `vcenter_ip`, `status`, `sla_id` FROM vm_list ORDER BY sla_id ASC;

MySQL order null 0 - 把null和0(零)排在最后

2、这个很显然不是我想要的结果,修改SQL如下[红色为关键语句]

SELECT `vcenter_ip`, `status`, `sla_id` FROM vm_list ORDER BY sla_id is NULL, sla_id = 0, sla_id ASC;

MySQL order null 0 - 把null和0(零)排在最后

相关文章:

  • 2021-11-04
  • 2021-10-09
  • 2022-12-23
  • 2021-12-22
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
相关资源
相似解决方案