sql join query through Adventure works database
Select pr.Color, count(*), sum(sr.UnitPrice * sr.OrderQty) as total
from Production.Product as pr
Join Sales.SalesOrderDetail as sr
on sr.ProductID=pr.ProductID
WHERE pr.Color IS NOT NULL
GROUP BY pr.Color
HAVING  sum(sr.UnitPrice * sr.OrderQty) &gt;50000
 ;