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 '%UNKNOWN_PLACEHOLDER_0UNKNOWN_PLACEHOLDER_1UNKNOWN_PLACEHOLDER_2UNKNOWN_PLACEHOLDER_3+lg+kc780%' OR LOWER(product_code) LIKE '%UNKNOWN_PLACEHOLDER_4UNKNOWN_PLACEHOLDER_5UNKNOWN_PLACEHOLDER_6UNKNOWN_PLACEHOLDER_7+lg+kc780%' OR LOWER(mas_id) LIKE '%UNKNOWN_PLACEHOLDER_8UNKNOWN_PLACEHOLDER_9UNKNOWN_PLACEHOLDER_10UNKNOWN_PLACEHOLDER_11+lg+kc780%' OR LOWER(masname) LIKE '%UNKNOWN_PLACEHOLDER_12UNKNOWN_PLACEHOLDER_13UNKNOWN_PLACEHOLDER_14UNKNOWN_PLACEHOLDER_15+lg+kc780%' OR LOWER(nametype) LIKE '%UNKNOWN_PLACEHOLDER_16UNKNOWN_PLACEHOLDER_17UNKNOWN_PLACEHOLDER_18UNKNOWN_PLACEHOLDER_19+lg+kc780%' OR LOWER(comp) LIKE '%UNKNOWN_PLACEHOLDER_20UNKNOWN_PLACEHOLDER_21UNKNOWN_PLACEHOLDER_22UNKNOWN_PLACEHOLDER_23+lg+kc780%' OR LOWER(meta_keywords) LIKE '%UNKNOWN_PLACEHOLDER_24UNKNOWN_PLACEHOLDER_25UNKNOWN_PLACEHOLDER_26UNKNOWN_PLACEHOLDER_27+lg+kc780%' OR LOWER(productID) LIKE '%UNKNOWN_PLACEHOLDER_28UNKNOWN_PLACEHOLDER_29UNKNOWN_PLACEHOLDER_30UNKNOWN_PLACEHOLDER_31+lg+kc780%' )