MySQL Workbench - SELECT 在使用 CASE WHEN 语句时在此服务器版本的此位置无效

MySQL Workbench - SELECT is not valid at this position with this server version when using CASE WHEN statement

在 MySQL Workbench 中实现基本 CASE WHEN 语句时,出现以下错误“SELECT 在此服务器版本的此位置无效。期待 FOR,锁定、表、值、带、'('".

这是我的 SQL 查询:

SELECT mode_dsc, Weight, rate, min_cost, 
CASE 
    WHEN (Weight*rate) < min_cost THEN min_cost AS Cost
    WHEN (Weight*rate) > min_cost THEN (Weight*rate) AS Cost
END AS Cost
FROM OrderLineRate
WHERE mode_dsc = "AIR";

OrderLineRate table 包含以下内容:

OrderID ProductID mode_dsc Weight minm_wgh_qty max_wgh_qty rate min_cost
1447133055 1678648 AIR 1.463 0 99.99 [=14=].05 .50

软件:MySQLWorkbench(版本 8.0.22.CE)与 MySQL 服务器(版本 8.0.22)

交互

因为费用只有在案件结束后才合适。

SELECT mode_dsc, Weight, rate, min_cost, 
CASE 
    WHEN (Weight*rate) < min_cost THEN min_cost 
    WHEN (Weight*rate) > min_cost THEN (Weight*rate) 
END AS Cost
FROM OrderLineRate
WHERE mode_dsc = "AIR";