SELECT *, nume_ofspec as title FROM ofspec_table_lang1 AS A, ofspec_table_common AS B WHERE B.id_ = '83' AND (A.id_ofspec=B.id_ofspec) AND ((B.expira > '2019-10-20') OR (B.expira = '0000-00-00')) ORDER BY `nume_ofspec` ASC LIMIT 0, 15 Invalid query: SELECT *, nume_ofspec as title FROM ofspec_table_lang1 AS A, ofspec_table_common AS B WHERE B.id_ = '83' AND (A.id_ofspec=B.id_ofspec) AND ((B.expira > '2019-10-20') OR (B.expira = '0000-00-00')) ORDER BY `nume_ofspec` ASC LIMIT 0, 15 Unknown column 'B.id_' in 'where clause'