विंडो फ़ंक्शन के न्यूनतम और अधिकतम के साथ विक्रेता की राशि की तुलना करें और बाहरी क्वेरी स्तर पर एक सशर्त गणना चलाएं:
SELECT vendor_id
, count(min_bid OR NULL) AS min_bid_count
, count(max_bid OR NULL) AS max_bid_count
FROM (
SELECT vendor_id
, amount = min(amount) OVER w AS min_bid
, amount = max(amount) OVER w AS max_bid
FROM rfq_vendor_mapping
WINDOW w AS (PARTITION BY rfq_id)
) sub
GROUP BY 1
ORDER BY 1;