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 'Alfas del Pi' AND CASE WHEN properties_loc4.name_ru_loc4 IS NOT NULL THEN pr...' at line 70