最近用到的informix sql,关于时间函数
来源:互联网 发布:网狐棋牌游戏源码 编辑:程序博客网 时间:2024/05/16 04:37
http://lhbthanks.iteye.com/blog/1667174
http://blog.csdn.net/amaryh/article/details/5282634
select sendtime, sheetcompletelimit, ((sheetcompletelimit-sendtime)::interval second(9) to second ::char(20) ::integer), extend(sendtime,hour to hour)
from businesschange_main where sendtime > '2013-07-12 15:59:59'
2013-7-12 下午4:17:25'2013-7-19 下午3:50:01'603156
2013-7-12 下午4:28:25'2013-7-19 下午4:01:01'603156
inforix统计sql,case when 语句,sum求和。
select task.subtaskflag as s1,
nvl(sum(case when task.taskstatus='2' then 1 else 0 end),0) as f1,--"待受理",指派发后未受理的工单
nvl(sum(case when task.taskstatus='8' then 1 else 0 end),0) as f2, ---"待处理",指受理后未回复的工单
nvl(sum(case when task.taskname='HoldHumTask' then 1 else 0 end),0) as f3,---"待归档",指回复后未归档的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(2) day to day and main.sheetcompletelimit-current<=interval(3) day to day then 1 else 0 end),0) as f4,--"3天超时预警",指距回复时限还有3~5天的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(3) day to day and main.sheetcompletelimit-current<=interval(5) day to day then 1 else 0 end),0) as f8,--"5天超时预警",指距回复时限还有2~3天的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(1) day to day and main.sheetcompletelimit-current<=interval(2) day to day then 1 else 0 end),0) as f5,--"2天超时警告",指距回复时限还有1~2天的工单
nvl(sum(case when main.sheetcompletelimit>=current and main.sheetcompletelimit-current<=interval(1) day to day then 1 else 0 end),0) as f6,--、"1天超时警告",指距回复时限还有0~1天的工单
nvl(sum(case when current>main.sheetcompletelimit then 1 else 0 end),0) as f7 --"已超时工单数",指已超时未回复的工单。
from businessdredge_main main,businessdredge_task task where
main.sendtime>=extend(today-30,year to second)
and main.id=task.sheetkey and (task.taskstatus='2'or task.taskstatus='8'or task.taskname='HoldHumTask')
and task.createtime in (select max(createtime) from businessdredge_task kk where kk.sheetkey=main.id group by main.id) group by task.subtaskflag
http://blog.csdn.net/amaryh/article/details/5282634
http://www.forumtopics.com/busobj/viewtopic.php?p=507955&sid=ecc0559a028f637dcd6459a91a3fbbed
两个时间段函数相减,得到的秒数。 extend(sendtime,hour to hour) 截取小时数select sendtime, sheetcompletelimit, ((sheetcompletelimit-sendtime)::interval second(9) to second ::char(20) ::integer), extend(sendtime,hour to hour)
from businesschange_main where sendtime > '2013-07-12 15:59:59'
2013-7-12 下午4:17:25'2013-7-19 下午3:50:01'603156
2013-7-12 下午4:28:25'2013-7-19 下午4:01:01'603156
inforix统计sql,case when 语句,sum求和。
select task.subtaskflag as s1,
nvl(sum(case when task.taskstatus='2' then 1 else 0 end),0) as f1,--"待受理",指派发后未受理的工单
nvl(sum(case when task.taskstatus='8' then 1 else 0 end),0) as f2, ---"待处理",指受理后未回复的工单
nvl(sum(case when task.taskname='HoldHumTask' then 1 else 0 end),0) as f3,---"待归档",指回复后未归档的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(2) day to day and main.sheetcompletelimit-current<=interval(3) day to day then 1 else 0 end),0) as f4,--"3天超时预警",指距回复时限还有3~5天的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(3) day to day and main.sheetcompletelimit-current<=interval(5) day to day then 1 else 0 end),0) as f8,--"5天超时预警",指距回复时限还有2~3天的工单
nvl(sum(case when main.sheetcompletelimit-current>=interval(1) day to day and main.sheetcompletelimit-current<=interval(2) day to day then 1 else 0 end),0) as f5,--"2天超时警告",指距回复时限还有1~2天的工单
nvl(sum(case when main.sheetcompletelimit>=current and main.sheetcompletelimit-current<=interval(1) day to day then 1 else 0 end),0) as f6,--、"1天超时警告",指距回复时限还有0~1天的工单
nvl(sum(case when current>main.sheetcompletelimit then 1 else 0 end),0) as f7 --"已超时工单数",指已超时未回复的工单。
from businessdredge_main main,businessdredge_task task where
main.sendtime>=extend(today-30,year to second)
and main.id=task.sheetkey and (task.taskstatus='2'or task.taskstatus='8'or task.taskname='HoldHumTask')
and task.createtime in (select max(createtime) from businessdredge_task kk where kk.sheetkey=main.id group by main.id) group by task.subtaskflag
- 最近用到的informix sql,关于时间函数
- informix的一些函数,时间
- 最近用到的mysql函数
- 最近用到感觉实用的JS操作时间的函数(续...)
- 关于最近我用到的linux命令
- 最近用到的matlab的一些函数
- wordpress几个我最近用到的函数
- 最近用到的一些封装函数~
- 收集最近用到的几个oracle函数
- INFORMIX 时间函数大全
- INFORMIX时间函数笔记
- [转贴]Informix SQL函数的详细用法
- [转贴]Informix SQL函数的详细用法
- Informix SQL函数的详细用法
- Informix SQL函数的详细用法
- Informix SQL函数的详细用法
- informix sql函数
- informix sql函数使用说明
- CLR 基础备忘 (纯个人复习备忘)
- linux中jdk的卸载与安装
- 继承扩展jQuery Mobile的初始化事件
- JAVA_WEB Oracle 10g学习: 本地动态SQL
- 怎么跟妻子解释面向对象
- 最近用到的informix sql,关于时间函数
- 深入jQuery Mobile的事件
- 常用的 SQL语句 汇总
- 申请环境标志认证应具备的条件
- 插入块参照后,将块内对象坐标换算为其当前dwg中的坐标
- Android Frame动画实例
- 解决《windows 能连接cmcc 但是浏览器打不开登入界面》问题
- snprintf
- 40多个关于人脸检测/识别的API、库和软件