Unknown column 'M' in 'where clause'