I have a simple query like this:
SELECT IF(production_center='production center 1',total_sales_less_taxes,0)
as PC1_sales FROM ...
This fails with Query Failed Error: Unexpected.
depending on the value of the string 'production center 1'
for example if I change that string to 'NYC' which is also in the data base as a production_center value, it fails. If I change 'production center 1' to 'production center' it fails, but if I change it to 'production center xyzzy' its okay.
There is no pattern whatsoever to the failure mode.
The work around I am using is to replace production_center = ... with production_center CONTAINS '....'
which works fine.