Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT s.BusinessEntityID AS 'ID Vendedor',
- SUM(S2008.SalesQuota) AS 'Total Quota Ventas 2008',
- SUM(S2007.SalesQuota) AS 'Total Quota Ventas 2007'
- FROM Sales.SalesPerson AS S
- LEFT OUTER JOIN Sales.SalesPersonQuotaHistory AS S2008
- ON S.BusinessEntityID = S2008.BusinessEntityID
- AND YEAR(S2008.QuotaDate) = 2008
- LEFT OUTER JOIN Sales.SalesPersonQuotaHistory AS S2007
- ON S.BusinessEntityID = S2007.BusinessEntityID
- AND YEAR(s2007.QuotaDate) = 2007
- GROUP BY S.BusinessEntityID;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement