Unknown column 'CURLY' in 'where clause'