MySQL "case as column" question in WHERE clause I'm setting up a new column with this case statement:

SELECT * , 
CASE t2.field_max_occupancy_value
WHEN  'one' THEN 1 
WHEN  'two' THEN 2 
WHEN  'three' THEN 3 
WHEN  'four' THEN 4 
WHEN  'five' THEN 5 
WHEN  'six' THEN 6 
WHEN  'seven' THEN 7 
WHEN  'eight' THEN 8 
WHEN  'nine' THEN 9 
WHEN  'ten' THEN 10 
ELSE 0 
END AS numfield
FROM field_data_field_rate_dates t1
LEFT JOIN field_data_maximum_occupancy t2 on t2.entity_id = t1.entity_id
WHERE t1.field_rate_dates_value &lt;=  '2015-07-11'


When I run that query - it works just fine - and I see numfield in the output.

However - when I append something to the WHERE clause...

AND numfield >= 3

It tells me that numfield is an unknown column.

Any ideas as to why?  Is there a declaration I need to make somewhere?  Thanks!
Aliases can't be used in WHERE. There are couple workarounds.
1. Repeat CASE in WHERE as oNare suggests
2. Put numfield &gt;3 in HAVING instead of WHERE (works for Mysql only)
3. Rewrite  query to use inline view syntax :   

SELECT a.* FROM 
(
SELECT * , 
CASE t2.field_max_occupancy_value
WHEN  'one' THEN 1 
WHEN  'two' THEN 2 
WHEN  'three' THEN 3 
WHEN  'four' THEN 4 
WHEN  'five' THEN 5 
WHEN  'six' THEN 6 
WHEN  'seven' THEN 7 
WHEN  'eight' THEN 8 
WHEN  'nine' THEN 9 
WHEN  'ten' THEN 10 
ELSE 0 
END AS numfield
FROM field_data_field_rate_dates t1
LEFT JOIN field_data_maximum_occupancy t2 on t2.entity_id = t1.entity_id
WHERE t1.field_rate_dates_value &lt;=  '2015-07-11'
)a 
WHERE  numfield &gt;= 3