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
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
你的语句我看不懂,向你学习....