Unknown column 'extern' in 'where clause'