Skip to main content

Nested IF or CASE in stat builder - Community / Feature Request - Deskpro Support

27

Nested IF or CASE in stat builder Collecting Feedback

I would like to be able to  use CASE in the SELECT statement for DPQL.


I want the channel to display differently, i.e. instead of gateway.person, it will display as "user email" instead.


Example:


SELECT DPQL_COUNT(),
CASE
WHEN tickets.creation_system = 'gateway.agent' THEN 'agent email'
WHEN tickets.creation_system = 'gateway.person' THEN 'user email'
WHEN tickets.creation_system = 'web.agent.portal' THEN 'agent interface'
WHEN tickets.creation_system = 'web.person.portal' THEN 'user via portal'
ELSE 'Others'
END AS 'Channel'
FROM tickets
WHERE tickets.date_created = ${date}
GROUP BY tickets.creation_system



Add a comment

Please log in or register to submit a comment.

Need a password reminder?