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 = 0 AND c.category_id = AND p.id <> 22787 AND p.price >= 47.992 AND p.price <= 71.988 limit 4