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
我在哪里做错了?
最佳答案
尝试
原文链接:https://www.f2er.com/mysql/433228.htmlSELECT *
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
你有太多的End和太多的desc