东言肆语

关注

【MySQL】mysql | select case

东言肆语

关注

阅读 89

2022-11-25


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'

相关推荐

浮游图灵

mysql select into

浮游图灵 129 0 0

热爱生活的我一雷广琴

sql case select

热爱生活的我一雷广琴 69 0 0

一枚路过的程序猿

pgsql,mysql case when

一枚路过的程序猿 167 0 0

eelq

MySQL case when 用法

eelq 64 0 0

灵魂跑者

mysql case when then用法

灵魂跑者 140 0 0

爱我中华8898

mysql case when使用

爱我中华8898 11 0 0

科牛

Mysql case when 用法

科牛 112 0 0

月白色的大狒

mysql select IN优化

月白色的大狒 48 0 0

爱薇Ivy趣闻

mysql update select

爱薇Ivy趣闻 188 0 0

guanguans

mysql中的case语句

guanguans 101 0 0

精彩评论(0)

0 0 举报