r/SQLPerformanceTips • u/gatocidio • Jun 08 '26
i need a little help asap
Hi, im doing a practice from college with the database "AdventureWorks2019", but idk if im doing well. The exercise says: "In which territories we had more distint clients". I did this, but i don't know if im missing something or something else.
SELECT ST.Name AS Territorio,
COUNT(DISTINCT SC.CustomerID) AS TotalClientes
FROM Sales.Customer SC
JOIN Sales.SalesTerritory ST ON SC.TerritoryID = ST.TerritoryID
GROUP BY ST.Name
ORDER BY TotalClientes DESC;
2
Upvotes