0
点赞
收藏
分享

微信扫一扫

【MySQL】mysql | select case

东言肆语 2022-11-25 阅读 89


SELECT
table.col1 as 'col1',
(case
when table.col2 = 0 then 'col2为0'
when table.col2 = 1 then 'col2为1'
when table.col2 = 2 then 'col2为2'
else 'col2为0、1、2之外的值' end ) as 'col2',
table.col3 as 'col3'
FROM
table
WHERE table.col3 = '1'

举报

相关推荐

0 条评论