SELECT p.name, p.brand, COUNT(po.id) as offer_count, array_agg(DISTINCT f.name) as shops
FROM products p
JOIN product_offers po ON po.product_id = p.id
JOIN feeds f ON f.id = po.feed_id
WHERE p.brand ILIKE 'Nike'
GROUP BY p.id, p.name, p.brand
HAVING COUNT(po.id) > 1
ORDER BY offer_count DESC
LIMIT 10;
