| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 1581 人关注过本帖
标题:达人们救命啊
取消只看楼主 加入收藏
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
 问题点数:0 回复次数:5 
达人们救命啊
小弟执行下面这段程序,总是报错,请求指点,不甚感激
select alarmGrade, stattime,  cfg.ipaddr, cfg.sevice,  
         case alarmItem when 1 then '非关键业务带宽占用率'+valveExp+valveValue+'%'
                        else '非关键业务带宽占用量'+valveExp+valveValue end as alarmCond,
         case alarmItem when 1 then 1-sum(sendbytes+recvbytes)/200000 else sum(sendbytes+recvbytes) end as alarmValue
from alarm_cfg as cfg, user_traffic as uData
where cfg.sevice=uData.sevice and case  when cfg.ipaddr=-1 then 1 else cfg.ipaddr=uData.ipaddr end and stattime>100
group by cfg.sevice, cfg.ipaddr, cfg.alarmGrade, cfg.alarmItem, cfg.valveExp, cfg.valveValue
having (case alarmItem when 1
    then case valveExp when '=' then 1-sum(sendbytes+recvbytes)/200000=valveValue
             when '<' then 1-sum(sendbytes+recvbytes)/200000<valveValue
            when '>' then 1-sum(sendbytes+recvbytes)/200000>valveValue
            else 1-sum(sendbytes+recvbytes)/200000<>valveValue
            end
    else case valveExp when '=' then sum(sendbytes+recvbytes)=valveValue
            when '<' then sum(sendbytes+recvbytes)<valveValue
            when '>' then sum(sendbytes+recvbytes)>valveValue
            else  sum(sendbytes+recvbytes)<>valveValue
        end
        end=1);
搜索更多相关主题的帖子: 救命 
2008-07-25 10:44
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
得分:0 
两个when 1是两个属性的判断,这里倒是没报错,后面的where cfg.sevice=uData.sevice and case  when cfg.ipaddr=-1 then 1 else cfg.ipaddr=uData.ipaddr end and stattime>100
有错误
2008-07-25 10:59
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
得分:0 
呵呵,我试试,谢谢你啊
2008-07-25 11:24
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
得分:0 
还是不行啊,case  when cfg.ipaddr=-1 then 1 else cfg.ipaddr=uData.ipaddr end 这句我的本意是当cfg.ipaddr=-1时,这个条件就为真不判断了,否则就判断cfg.ipaddr=uData.ipaddr这个条件
2008-07-25 11:31
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
得分:0 
恩,麻烦你了
2008-07-25 11:35
qisong123456
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2008-7-1
收藏
得分:0 
好了,好了,真是太感谢你了
2008-07-25 11:45
快速回复:达人们救命啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019066 second(s), 10 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved