فراموش نکن عبارت Group By باید دارای همه ی ستون ها یت باشد بجز ستونی که می خواهی بر اساس آن گزارش چکیده بگیری.(Count..)
--Tables:
/*
Sale { ProductId, CustomerId }
Product { Name, Model }
*/
--Returns the top 10 models of products.
Select Top 10 Name, Model
from Product
order by Model
--Returns the top 5 products that have been saled.
SELECT Top 5 Product.Name, Product.Model, COUNT(Sale.ProductId) AS Number
FROM Sale INNER JOIN
Product ON Sale.ProductId = Product.Id
GROUP BY Name, Model
Order by Count(ProductId) desc