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 <= '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!