Is it possible to create a selection based on a 'case value'. In below example the Category. Let's say I want to get the Low value. It throws up a error when I use WHERE Category = 'Low', because the column Category does not exist.
I know I could create the selection by replacing WHERE Category = 'Low' with Where digit > 0 AND digit <=40. But that seems like a bad way to do so because off the double expression.
SELECT digits,
CASE
When digit > 0 AND digit <=40 THEN 'Low'
When digit > 40 AND digit <=75 THEN 'Average'
When digit > 75 THEN 'High'
END AS Category
FROM digits_table
WHERE Category = 'Low'