SHARE
TWEET

Untitled

a guest Dec 12th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE VIEW vw_Sales
  2.  
  3. AS
  4. SELECT Sales.SaleNo AS [Sale Number], Sales.SaleDate AS [Sale Date], Customers.FirstName AS [First Name],
  5.         Customers.LastName AS [Last Name], Categories.AgeBracket AS [Age Bracket],
  6.         Products.ProductDescription AS [Item Description], Types.TypeDescription AS [Item Type],
  7.         Products.Year AS [Year Made], Products.Price AS [Price ex. GST],
  8.         dbo.fn_CalculateGST(Products.ProductID) AS [GST],                                                           -- Use CalcuateGST function to return
  9.         (Products.Price + dbo.fn_CalculateGST(Products.ProductID)) AS [Total Price]                             -- GST for each ProductID
  10.  
  11. FROM Sales
  12.     JOIN Customers ON Customers.CustomerID = Sales.CustomerID
  13.     JOIN Categories ON Categories.CategoryID = Customers.CategoryID
  14.     JOIN SaleProducts ON SaleProducts.SaleNo = Sales.SaleNo
  15.     JOIN Products ON Products.ProductID = SaleProducts.ProductID
  16.     JOIN Types ON Types.TypeID = Products.TypeID
  17.  
  18. GO
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top