You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and SITE_LANGS.LANGID IS NOT NULL' at line 1 SELECT *, as name, as lang_name FROM NAVIGATION LEFT JOIN SITE_LANGS on SITE_LANGS.LANGID = NAVIGATION.LANGID WHERE SITE_LANGS.status = 1 and page = '' and NAVIGATION.LANGID != and SITE_LANGS.LANGID IS NOT NULL