select a.iaca, t.airport_name, t.city, c.description, a.citycode, t.language, t.result, t.languageorder, a.countrycode from airports as a join () as t on a.iaca = t.iaca join countrycode as c on a.countrycode = c.code and c.language = t.language order by t.result desc, t.languageorder desc limit 0, 10 --- 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 ') as t on a.iaca = t.iaca join countrycode as c on a.countrycode = c.code and c.' at line 1