Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[MySQL][ODBC 3.51 Driver][mysqld-5.5.5-10.6.16-MariaDB]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 subcategory.category_id = AND midcategory.midcategory_id = subcategory.m...' at line 1

/dynamic.asp, line 177