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 = 539 AND c.category_id = AND p.id <> 13461 AND p.price >= 32.632 AND p.price <= 48.948 limit 4