【技术支持】Oracle plsql中的having子句并非都能改写成where子句。having子句的适用场景。
来源:互联网 发布:linux expect spwan 编辑:程序博客网 时间:2024/05/22 07:02
一句话:
group by子句让聚合函数输出不同的记录,having子句优先级低于聚合函数,其就是用于筛选聚合后的各组值,以弥补where子句的不足。所以,having子句中的条件必须是聚合函数。
例子:
update t_userinfo tu set tu.status = 3 , tu.update_time = to_date(str_date, 'yyyy-mm-dd hh24:mi:ss') where tu.status = 1 and exists (select 1 from t_annoyance ta where ta.call_userid = tu.userid and ta.insert_time >= to_date(str_date, 'yyyy-mm-dd hh24:mi:ss') - 30 and ta.call_time < 6 group by tu.userid having count(distinct ta.becall_userid) > 50)
参考:
http://zhidao.baidu.com/link?url=WOtpjrbl3LLNX08hvGrG4UKjtq5Jh1_j1tNax3s-Ygg33n5O0n9pAQAFa2Z_ZSyPNLy51raZ-3WSOfemClj41a
0 0
- 【技术支持】Oracle plsql中的having子句并非都能改写成where子句。having子句的适用场景。
- oracle中的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子句中的区别
- 【having子句】在oracle中where 子句和having子句中的区别
- HAVING子句与WHERE子句的区别
- IE 等兼容下的video radio
- Linux下定时任务配置-crontab
- tomcat配置数据源
- 记录帖:重写dialog去掉黑边的样式设置
- android app 设计
- 【技术支持】Oracle plsql中的having子句并非都能改写成where子句。having子句的适用场景。
- SQLite实例
- C语言中strcat的实现方法
- C/C++校招笔试面试经典题目总结三
- c语言实现二叉树层次遍历(借助队列实现)
- JS 学习记录
- CoCreateInstanceEx函数使用
- 网络服务器虚拟化
- TCP连接建立过程中为什么需要“三次握手”