Unknown column 'works' in 'where clause'