SHARE
TWEET

Untitled

a guest Mar 18th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT NULL AS pracID, NULL AS klientID, SUM(TotalDue) AS Suma
  2. FROM Sales.SalesOrderHeader
  3.  
  4. UNION ALL
  5. SELECT NULL, CustomerID, SUM(TotalDue)
  6. FROM Sales.SalesOrderHeader
  7. GROUP BY CustomerID
  8.  
  9. UNION ALL
  10. SELECT SalesPersonID, NULL, SUM(TotalDue)
  11. FROM Sales.SalesOrderHeader
  12. GROUP BY SalesPersonID
  13.  
  14. UNION ALL
  15. SELECT SalesPersonID, CustomerID, SUM(TotalDue)
  16. FROM Sales.SalesOrderHeader
  17. GROUP BY SalesPersonID, CustomerID
  18. ORDER BY 1
RAW Paste Data
Top