sql order by 结合case when then

时间:2023-05-17 08:49:02
SELECT
*
FROM
datav.a_current_per_entry_01
WHERE
intime = (SELECT
MAX(intime)
FROM
a_current_per_entry_01)
ORDER BY hour ASC , CASE
WHEN entry = '东1入口' THEN 1
WHEN entry = '西门入口' THEN 2
WHEN entry = '东南入口' THEN 3
WHEN entry = '正南入口' THEN 4
WHEN entry = '西南入口' THEN 5
END;