Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. SELECT s.BusinessEntityID AS 'ID Vendedor',
  2. SUM(S2008.SalesQuota) AS 'Total Quota Ventas 2008',
  3. SUM(S2007.SalesQuota) AS 'Total Quota Ventas 2007'
  4. FROM Sales.SalesPerson AS S
  5. LEFT OUTER JOIN Sales.SalesPersonQuotaHistory AS S2008
  6. ON S.BusinessEntityID = S2008.BusinessEntityID
  7. AND YEAR(S2008.QuotaDate) = 2008
  8. LEFT OUTER JOIN Sales.SalesPersonQuotaHistory AS S2007
  9. ON S.BusinessEntityID = S2007.BusinessEntityID
  10. AND YEAR(s2007.QuotaDate) = 2007
  11. GROUP BY S.BusinessEntityID;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement