You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ERROR: SELECT COUNT(DISTINCT p.productID) FROM ?#PRODUCTS_TABLE p where catego' at line 1 SQL query : ERROR: SELECT COUNT(DISTINCT p.productID) FROM ?#PRODUCTS_TABLE p where categoryID>1 and enabled=1 and ( LOWER(name) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(product_code) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(mas_id) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(nametype) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(comp) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(contry) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' OR LOWER(productID) LIKE '%c5+065eaf1caf2ee+f5eef7e5f2+efeee7ede0eaeeece8f2f1ffUNKNOWN_PLACEHOLDER_27+and+27x273d27y%' )