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%') AND (iberkshire.ss.date>='2012-08-01 00:00:00' AND iberkshire.ss.date<='...' at line 1