mysql中的when的用法_MySql中case...when...的用法
MySql中case...when...的用法SELECT(CASE WHEN ( xyz.字段1 IS NULL ) THEN '未监控'WHEN ( xyz.字段1 is not null and(xyz.字段2 = 0 or xyz.字段2 is null) ) THEN '0'WHEN ( xyz.字段1 is not null andxyz.字段2 > 0 AND xyz....
·
MySql中case...when...的用法
SELECT
(CASE WHEN ( xyz.字段1 IS NULL ) THEN '未监控'
WHEN ( xyz.字段1 is not null and (xyz.字段2 = 0 or xyz.字段2 is null) ) THEN '0'
WHEN ( xyz.字段1 is not null and xyz.字段2 > 0 AND xyz.字段2 <= 0.15 ) THEN '0%-15%'
...
...
WHEN ( xyz.字段1 is not null and xyz.字段2 > 0.6 AND xyz.字段2 <= 0.85 ) THEN '60%-85%'
ELSE '85%-100%' END ) AS xxx
FROM
a_b_c abc
LEFT JOIN x_y_z xyz ON abc.id = xyz.id
and abc.属性1 in
#{item}
AND abc.属性2 in
#{item}
AND abc.属性3 in
#{item}
©著作权归作者所有:来自51CTO博客作者zjy666的原创作品,如需转载,请注明出处,否则将追究法律责任
更多推荐
已为社区贡献2条内容
所有评论(0)