我正在用VB6创建一个前端,我的数据库是Sybase.使用DSN我创建了一些小的exe来填充网格中的报表.它工作正常.
但是,如果我使用以下查询,我只得到小时和已回答的数据.如果我在SQL查询中执行查询,则完成数据即将到来.
我相信总和(如果在VB6中不起作用,请指导我替代.
"select datepart (hh, callstartdt) as Hour, " _
& " count(seqnum) as Anaswered," _
& " sum(case when user_id <> NULL then 1 else 0 end) as answered_calls ," _
& " sum(case when user_id <> NULL and datediff (ss, callstartdt, QueueEndDt) <= 20 then 1 else 0 end) , " _
& " sum(case when user_id = NULL then 1 else 0 end), " _
& " sum(case when user_id <> NULL and datediff (ss, callstartdt, QueueEndDt) <= 20 then 1 else 0 end) / count(seqnum), " _
& " sum(Case when user_id <> NULL then 1 else 0 end ) / count(seqnum) from acdcalldetail " _
& " where callstartdt between '" & fromDt & "' and '" & toDt & "' " _
& " and service_id not in (37,39,47,51,57,58,96,215,374,375) " _
& " group by datepart (hh, callstartdt) " _
& " order by datepart (hh, callstartdt)"
Run Code Online (Sandbox Code Playgroud)
你不能使用when user_id <> Null.你必须使用user_id Is Null或user_id Is Not Null.Anything =或<> to Null会导致Unknown被视为Case表达式的false.
| 归档时间: |
|
| 查看次数: |
7477 次 |
| 最近记录: |