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