SQL之case when then用法
来源:互联网 发布:php信息管理系统 编辑:程序博客网 时间:2024/05/21 07:53
case具有两种格式。简单case函数和case搜索函数。
--简单case函数case sex when '1' then '男' when '2' then '女’ else '其他' end--case搜索函数case when sex = '1' then '男' when sex = '2' then '女' else '其他' end
这两种方式,可以实现相同的功能。简单case函数的写法相对比较简洁,但是和case搜索函数相比,功能方面会有些限制,比如写判定式。
还有一个需要注重的问题,case函数只返回第一个符合条件的值,剩下的case部分将会被自动忽略。
--比如说,下面这段sql,你永远无法得到“第二类”这个结果case when col_1 in ('a','b') then '第一类' when col_1 in ('a') then '第二类' else '其他' end
阅读全文
0 0
- SQL之case when then用法详解
- SQL之case when then用法
- SQL之case when then用法
- SQL之case when then用法
- SQL之case when then用法
- SQL之case when then用法详解
- SQL之case when then用法
- SQL之case when then用法
- SQL之case when then用法
- SQL之 case when then
- SQL之CASE,WHEN,THEN
- SQL之CASE,WHEN,THEN
- sql学习之CASE WHEN THEN ELSE END的用法
- SQL查询之case when then的用法
- SQL之case when then else end用法
- SQL case when then end 简单用法
- sql中case when then简单用法
- sql case when then end 用法
- 嚼得菜根做得大事·《菜根谭》·十一
- java中main函数的参数String[] args 的理解
- 短信验证码 ----- 点击发送并实现定时器
- js中的时间与毫秒数互相转换
- Second week of machine learning on Coursera
- SQL之case when then用法
- 在php里面post数据到其他目录下的php文件
- log4j2实现自定义Appender(输出到文件/RPC服务中)
- CentOS 6.5下bind文件配置解析
- 生成式对抗网络(Generative Adversarial Networks,GAN)
- FineReport报表和FineBI的差别和各自的优势在哪
- BZOJ 3319 并查集 解题报告
- input只能输入数字
- java工具类-解析出url参数中的键值对