Unknown column 'curves' in 'where clause'