I am working with real time viewing program that makes SQL queries (and let me edit bit of the code)
At the moment code is:
SELECT
[LogonName] AS [Logon name],
[LogonExtension] AS [Logon extension],
[VoiceReady] AS [Ready for Voice],
[CallState] AS [Call state]
FROM
[AgentPerformance]
WHERE
(AgentID IN (1, 2, 3))
This returns:
Now my question is that is there any way to change the returned "call state" values to let's say busy, free, handling etc... (there are 3 different values).
I have tried for example:
SELECT
[LogonName] AS [Logon name],
[LogonExtension] AS [Logon extension],
[VoiceReady] AS [Ready for Voice],
[CallState] AS [Call state]
FROM
[AgentPerformance]
WHERE
(AgentID IN (1, 2, 3))
SELECT
CASE
WHEN CallState = 0 THEN 'No'
WHEN CallState = 1 THEN 'Yes
ELSE 'Maybe'
END AS kakaduu
FROM
AgentPerformance
But this didn't work for me.
Your CASE
expression need to be in SELECT
list along with another columns. second SELECT
was incorrect syntax in your example.
So, try this:
SELECT [LogonName] AS [Logon name], [LogonExtension] AS [Logon extension], [VoiceReady] AS [Ready for Voice], [CallState] AS [Call state],
CASE
WHEN CallState = 0 then 'No'
WHEN CallState = 1 then 'Yes'
ELSE 'Maybe'
END
AS kakaduu
FROM [AgentPerformance]
WHERE AgentID IN (1, 2, 3)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.