Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created June 14, 2019 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/a8e7771ec9ebd60bbaf1ff057cee0a54 to your computer and use it in GitHub Desktop.
Save parzibyte/a8e7771ec9ebd60bbaf1ff057cee0a54 to your computer and use it in GitHub Desktop.
/*La suma de las ventas hechas por cada empleado, y agrupadas por año*/
select pp.FirstName, sum(SalesQuota) as total_vendido,
year(QuotaDate) as año
from Sales.SalesPersonQuotaHistory qh
inner join Person.Person pp
on qh.BusinessEntityID = pp.BusinessEntityID
group by pp.BusinessEntityID, year(QuotaDate), pp.FirstName
order by pp.BusinessEntityID;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment