Mixing Data from Views and Tables

It is a common practice to write queries that involve data from views and tables. You can mix data from both views and tables in several ways, such as joining tables with views. The following example demonstrates how to mix data from the HumanResources.vEmployeeDepartment view and the HumanResources.EmployeeAddress and Person.Address table. You can access this sample code from \Ch08\SampleCh0812.sql.

 SELECT HumanResources.vEmployeeDepartment.*, AddressLine1, City, PostalCode FROM HumanResources.EmployeeAddress INNER JOIN Person.Address    ON HumanResources.EmployeeAddress.AddressID = Person.Address.AddressID    INNER JOIN HumanResources.vEmployeeDepartment    ON HumanResources.EmployeeAddress.EmployeeID = HumanResources.vEmployeeDepartment.EmployeeID 


Solid Quality Learning, Microsoft Corporation Staff - Microsoft SQL Server 2005 Database Essentials Step by Step
Solid Quality Learning, Microsoft Corporation Staff - Microsoft SQL Server 2005 Database Essentials Step by Step
ISBN: N/A
EAN: N/A
Year: 2006
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net