Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by Fatih for DISTINCT on one column and return TOP rows

please try:

SELECT DISTINCT TOP 3  order_no, customer_name,  Purchase_CostFROM(   SELECT order_no, customer_name, Purchase_Cost, ROW_NUMBER() OVER(PARTITION BY customer_name ORDER BY Purchase_Cost DESC) Orders    FROM PurchaseTable) AWHERE A.Orders = 1ORDER BY Purchase_Cost DESC

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>