select case when time<30 then '小于30'
when time>=30 and time<45 then '30到45'
when time>=45 and time<60 then '45到60'
when time>=60 and time<120 then '60到120'
else '120以上' end,count(*) from 表 group by case
when time<30 then '小于30'
when time>=30 and time<45 then '30到45'
when time>=45 and time<60 then '45到60'
when time>=60 and time<120 then '60到120'
else '120以上' end
when time>=30 and time<45 then '30到45'
when time>=45 and time<60 then '45到60'
when time>=60 and time<120 then '60到120'
else '120以上' end,count(*) from 表 group by case
when time<30 then '小于30'
when time>=30 and time<45 then '30到45'
when time>=45 and time<60 then '45到60'
when time>=60 and time<120 then '60到120'
else '120以上' end
解决方案 »
- 关于分页面的存储过程
- 问3个比较类似的SQL语句的写法?有什么不一样?
- 请教:关于表空间和数据文件得问题。
- 简单的几个问题
- trigger调用procedure报错 java.security.AccessControlException,怎么解决啊?
- 存储过程中能否使用connectas语句连接另一个数据库,将本数据库中的表中的内容导入到另一个数据库中的表里
- worry:oracle数据库之间可不可以实现实时数据同步?
- 我用oracle database assistant创建了一个数据库实例,可是删不掉???
- 如何导出数据库结构,形成文档。你是如何做的?
- ORA-12592: TNS: 包错误,已快折磨死去,救命啊
- 表更新的问题,急
- 用UTL_SMTP包发送邮件时,如果邮件内容是中文,收到的内容就变成乱码,怎么办?
else '120以上' end,count(*) from 表 group by case when time<30 then '小于30' when time>=30 and time<45 then '30到45' when time>=45 and time<60 then '45到60' when time>=60 and time<120 then '60到120' else '120以上' end;
count(decode(time>30,0,1),
count(decode(time>30,decode(time>45,0,1),0),
count(decode(time>60,decode(time>120,0,1),0),
count(decode(time>120,1,0)
from
table
decode不是这么用的啊。不能用time>30的。select sum(decode(sign(time-30),-1,1,0)) as '30秒以内',
sum(decode(sign(time-30),-1,0,decode(sign(time-45),-1,1,0))) as '30-45秒',
.
.
.
sum(decode(sign(time-120),1,1,0)) as '120秒以上'
from table;
以上语句中的速度最快是bzszp(SongZip) (大约3s),
pengdali(大力 V3.0) 稍慢一点(3-4s),
snowy_howe(天下有雪)最慢(超过5s)。但是在Delphi中执行都存在同样的问题:
“多步操作产生错误.请检查每一步的状态值.”
请问该如何解决?附:我的Delphi代码:
ado_DS: TADODataSet;
ado_DS := TADODataSet.Create(nil);
ado_DS.Connection := ado_Connection;
ado_DS.CommandText := sSQL;
ado_DS.Open;
count(decode(time>60,decode(time>120,0,1),0),count(decode(time>120,1,0)from
table
你的语句我看不懂,向你学习....