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 = 407 AND c.category_id = AND p.id <> 7445 AND p.price >= 12.8 AND p.price <= 19.2 limit 4