gpt4 book ai didi

php - Mysql 大小写语法

转载 作者:可可西里 更新时间:2023-11-01 07:06:12 28 4
gpt4 key购买 nike

SELECT *
FROM case_study
ORDER BY CASE WHEN expiry_date_case > CURDATE() THEN 1 END
WHEN expiry_date_case IS NULL THEN 2 Desc END
WHEN expire_date_case < CURDATE() THEN 3 Desc END;

当我尝试运行此查询时,出现错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHEN expiry_date_case IS NULL THEN 2 Desc END WHEN expire_date_case < CURDATE() ' at line 4


我哪里做错了?

最佳答案

尝试

SELECT *
FROM case_study
ORDER BY CASE WHEN expiry_date_case > CURDATE() THEN 1
WHEN expiry_date_case IS NULL THEN 2
WHEN expire_date_case < CURDATE() THEN 3 END Desc

Enddesc 太多

关于php - Mysql 大小写语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30567696/

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