我有疑问我遇到了麻烦。我试图捕获下面KEY中的参数:
// We track all calls ending up in Workgroup Voice Mailbox:
// ExitReason:
// 9 - TransferVM
// 2 - ForwardAlways (Workgroup is set up to always forward calls)
// 3 - ForwardBusy
// 4 - ForwardNoAnswer
// 5 - ForwardNoAgent
//
// TargetType:
// 3 - Mailbox
//
// TargetDN:
// Target's Extension.
// If target is workgroup's mailbox (TargetDN = QueueDN and TargetType = 3)
// call ended up in workgroup mailbox.
//
我想要exectute的查询是:
Select CASE WHEN ExitReason = 9 AND
TargetType = 3 AND
TargetDN = QueueDN OR
ExitReason = 2 OR
ExitReason = 3 OR
ExitReason = 4 OR
ExitReason = 5 AND
TargetType = 3 THEN 1 ELSE 0 AS CallsVM
FROM (queuecall queuecall1 INNER JOIN connect connect1
ON queuecall1.ConnectTableID=connect1.ID) INNER JOIN call call1
ON connect1.CallTableID=call1.ID
我在AS,FROM中遇到了多个错误。任何援助都会很棒。 谢谢, 阿龙
答案 0 :(得分:1)
您在案例陈述中遗漏了关键字END
。您也错过了使用IN
e.g。
SELECT CASE
WHEN exitreason = 9
AND targettype = 3
AND targetdn = queuedn
OR exitreason IN ( 2, 3, 4, 5 )
AND targettype = 3 THEN 1
ELSE 0
END AS CallsVM
FROM queuecall queuecall1
INNER JOIN connect connect1
ON queuecall1.connecttableid = connect1.id
INNER JOIN call call1
ON connect1.calltableid = call1.id