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 = 763 AND c.category_id = AND p.id <> 26787 AND p.price >= 8 AND p.price <= 12 limit 4