Invalid query: SELECT distinct COUNT(*) AS result FROM shop_product as p, shop_category_product as c WHERE p.id = c.product_id AND p.active = 1 AND p.producer = 181 AND c.category_id = AND p.id <> 4358 AND p.price >= 127.2 AND p.price <= 190.8 limit 4