SELECT
s.s_id,
s.s_name,
s.s_sex,
CASE s.s_sex
WHEN '1' THEN '男'
WHEN '2' THEN '女'
ELSE '其他'
END as sex,
s.s_age,
s.class_id
FROM
t_b_student s
WHERE
1 = 1
sql语句中的case when then用法
最新推荐文章于 2024-05-22 10:37:39 发布
SELECT
s.s_id,
s.s_name,
s.s_sex,
CASE s.s_sex
WHEN '1' THEN '男'
WHEN '2' THEN '女'
ELSE '其他'
END as sex,
s.s_age,
s.class_id
FROM
t_b_student s
WHERE
1 = 1