oracle中的having子句
来源:互联网 发布:crm软件价格 编辑:程序博客网 时间:2024/06/06 11:43
oracle中的having子句
having子句
having子句和group by一起使用,紧跟在group by的后边,having子句可以使用结果集中的列,也可以使用聚合函数(max、min、count、sum、svg)。having的作用是对分组后的结果进行过滤。这里在提一下where,where是对每一行进行过滤的,查询出符合where条件的每一行。having是对查询出结果集分组后的结果进行过滤。
事例
我们现在有个mk_script_info渠道表,CHN_TYPE为渠道类型,如下图。
我们先统计一下渠道的数量。
现在我们的的需求是查询出渠道数量大于500的渠道。sql如下。我们可以看到having的用法,对分组统计后的chn_type数量进行了大于500的条件过滤。
参考文章:
http://blog.sina.com.cn/s/blog_53e731b70101lamz.html
http://www.cnblogs.com/jameshappy/archive/2012/05/23/2515034.html
1 0
- oracle中的having子句
- 【技术支持】Oracle plsql中的having子句并非都能改写成where子句。having子句的适用场景。
- 【having子句】在oracle中where 子句和having子句中的区别
- Oracle中where子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- oracle中where子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 6-oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- 在oracle中where 子句和having子句中的区别
- Oracle HAVING子句
- Oracle HAVING子句
- struts2学习总结(一)
- CocoaPods 的简单快速安装方法
- mvc加载控制器、模型类以及视图类编写
- sum-root-to-leaf-numbers
- MVC框架自己封装开启超神之路(上) 2-1入口文件
- oracle中的having子句
- Dijkstra算法
- PHP闭包 function() use()
- Linux下基于源码安装MySQL
- Android项目针对libs(armeabi,armeabi-v7a,x86)进行平台兼容
- Spring 缓存注解@Cacheable的用法
- 对MVC的理解
- js 生成sn
- subline的使用