I'm trying to run the following query against the application database and I keep getting a syntax error:
SELECT
CASE
WHEN executor_id IN (3, 16, 87, 74, 15, 4, 62, 55, 83, 72, 46, 38, 42, 66, 30, 101, 58, 95, 63, 47, 17, 124, 99, 41, 2, 36, 13, 9, 75, 123, 127, 43, 56, 110, 65, 97, 88, 59, 94) THEN 'Engineering'
WHEN executor_id IN (60, 8, 100, 96, 105, 130) THEN 'Finance/Accounting'
WHEN executor_id IN (54, 14, 19, 48, 57, 86, 85, 26, 73, 50, 27, 89, 32, 40, 116, 51, 71, 24, 118, 25, 106, 119, 117, 108, 107, 128, 109, 132) THEN 'Customer Success'
WHEN executor_id IN (7, 35, 11, 18, 76, 69, 12) THEN 'Product'
WHEN executor_id IN (64, 92, 45, 21, 6, 33, 68, 23, 78, 82, 84, 113, 93, 111, 98, 67, 120, 80, 22, 114, 79, 102, 121) THEN 'Sales/Revenue/Business Development'
WHEN executor_id IN (53, 91, 28, 49, 103) THEN 'Marketing'
WHEN executor_id IN (5, 81, 29, 90) THEN 'HR/Operations'
WHEN executor_id IN (37, 20) THEN 'Design'
ELSE executor_id
END AS "Business Unit",
COUNT(*) AS "# of Successfully Executed Queries"
FROM query_execution
WHERE error IS NULL
GROUP BY "Business Unit"
ORDER BY "# of Successfully Executed Queries" DESC
I've also tried to use a combination of CASE and CONTAINS in the notebook editor, but the CONTAINS statement will not allow me to select the executor_id variable. Any ideas?