Accountants in

SELECT b.*, t.nameTown, c.nameCounty, t.sefTown, c.sefCounty from businesses_accountants b
join towns t on b.idTown = t.idTown
join counties c on t.idCounty = c.idCounty
where
b.idBusinessType = 168715 and b.idTown = 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 '' at line 5