I am currently using the REPLACE function to change a couple record names (ints to their corresponding human readable name) like this:
SELECT SUM(COUNT) AS Actions, replace(replace(replace(replace(replace(replace(EVENT, 2, 'iOS'), 1, 'Web'), 3, 'Android'), 4, 'Windows'), 5, 'Mac'), 6, 'Unknown') AS Platform
FROM `METRICS_WEEKLY`
WHERE EVENT IN (1, 2, 3, 4 ,5 ,6)
GROUP BY EVENT
I would like to build a query which is using more than 30 numbers in the the EVENT column and map them to friendlier names. I am unable to alter the current table (I am not the creator of the table schema). Is there an easier way to map a larger group of field names?
Try this: