云计算学习路线图素材、课件,CASE的其他用法讲解
在本篇文章中将给大家讲解下CASE的其他用法讲解: 使用带有简单CASE函数和CASE搜索函数的select语句在select语句中,CASE搜索函数允许根据比较值 select CASE WHEN good_type<2 THEN '<2' WHEN good_type>=2 AND good_type<3 THEN '>=2 && <3' ELSE '>=3' END AS good_now_type, good_type,user_id,user_name FROM t_main_order; +---------------+-----------+---------+-----------+ | good_now_type | good_type | user_id | user_name | +---------------+-----------+---------+-----------+ | <2 | 0 | 1 | tina | | <2 | 0 | 2 | tige | | <2 | 1 | 3 | five | | >=2 && <3 | 2 | 4 | wate | | >=3 | 3 | 5 | fiww | | >=3 | 3 | 6 | www | | >=3 | 3 | 7 | wfiw | +---------------+-----------