Skip to content

Instantly share code, notes, and snippets.

@carinavockell
Created September 12, 2022 16:14
Show Gist options
  • Save carinavockell/dba94cd2a820b800c8375b4f7fc48119 to your computer and use it in GitHub Desktop.
Save carinavockell/dba94cd2a820b800c8375b4f7fc48119 to your computer and use it in GitHub Desktop.
In the output below, ProductID values 1, 3, 2, and 316 don’t have associated sales, so the TotalSales column from the Sales.GetSalesByProduction function returns a NULL.
SELECT p.ProductID, p.Name, x.TotalSales
FROM Production.Product p
OUTER APPLY Sales.GetSalesByProduct (p.ProductID) AS x;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment