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 REPLACE(streetName,'\'','') like '%%' ORDER BY sellDate DESC' at line 1SELECT count(*) total FROM history WHERE sellDate < '2023-10-30' and sellDate > '1969-11-30' and streetNumber= and REPLACE(streetName,'\'','') like '%%' ORDER BY sellDate DESC