Unknown column 'middle' in 'where clause'