ORDERS

 

 

 

CREATE VIEW [dbo].[vOrders]

AS

      SELECT Orders.*, Customers.CompanyName as CustomerName, Employees.LastName + ', ' +

           Employees.FirstName as Employee, Shippers.CompanyName as Shipping

      FROM Orders

      LEFT OUTER JOIN Customers ON Customers.CustomerID = Orders.CustomerID

      LEFT OUTER JOIN Employees ON Employees.EmployeeID = Orders.EmployeeID

      LEFT OUTER JOIN Shippers ON Shippers.ShipperID = Orders.ShipVia

GO

 

We use the vOrders View to pull the CustomerName, Employee and Shipping information for the Browse mode below


 

 

CREATE VIEW [dbo].[vOrder Details]

AS

 

      SELECT [Order Details].*, Products.ProductName, Orders.OrderDate

      FROM  [Order Details]

      INNER JOIN Orders ON Orders.OrderID =  [Order Details].OrderID

      INNER JOIN Products ON  Products.ProductID = [Order Details].ProductID

 

GO

 

The “vOrder Details” view is used to pull the ProductName for the browse mode below