gpt4 book ai didi

mysql - mysql中按特定单词排序

转载 作者:行者123 更新时间:2023-11-29 06:43:42 24 4
gpt4 key购买 nike

我有以下数据: enter image description here

我想首先显示最近状态为“到期”的所有发票。我如何订购这些数据。

注意:我正在使用 Mysql 数据库。

最佳答案

这应该按顺序对到期、已付和其他进行排序:

SELECT Date, Invoice, ProductName, Qty, Rate, TotalPrice, PaymentStatus, PaymentType
FROM xxxTable
ORDER BY CASE
WHEN PaymentStatus LIKE "%Due%" then 1
WHEN PaymentStatus LIKE "%Paid%" then 2
ELSE 3
END

关于mysql - mysql中按特定单词排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50432538/

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