gpt4 book ai didi

mysql - 按 asc 排序,但当值 0 位于 codeigniter 的最后时

转载 作者:行者123 更新时间:2023-11-29 07:11:01 26 4
gpt4 key购买 nike

这是我的订单代码

$this->db->order_by('diskon', 'asc');

diskon 是一个数字。我想将值为 0 的 discon 放在最后。所以一定是这样的

1
2
4
6
0

希望你明白我的意思,谢谢。

最佳答案

你可以这样做:

order by (diskon > 0) desc, diskon asc

关于mysql - 按 asc 排序,但当值 0 位于 codeigniter 的最后时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39700851/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com