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 'from o_advertising_view where date(datetime_insert)='2018-02-22' and advertising' at line 1