Latest revision |
Your text |
Line 1: |
Line 1: |
| == wikibot == | | == wikibot == |
− |
| |
− | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
| |
− | |- valign="top"
| |
− | | '''View
| |
− | | Sales.vSalesPerson
| |
− | |- valign="top"
| |
− | | '''Description
| |
− | | Sales representiatives (names and addresses) and their sales-related information.
| |
− | |}
| |
− |
| |
− | === Source ===
| |
− | <pre>
| |
− | CREATE VIEW [Sales].[vSalesPerson]
| |
− | AS
| |
− | SELECT
| |
− | s.[SalesPersonID]
| |
− | ,c.[Title]
| |
− | ,c.[FirstName]
| |
− | ,c.[MiddleName]
| |
− | ,c.[LastName]
| |
− | ,c.[Suffix]
| |
− | ,[JobTitle] = e.[Title]
| |
− | ,c.[Phone]
| |
− | ,c.[EmailAddress]
| |
− | ,c.[EmailPromotion]
| |
− | ,a.[AddressLine1]
| |
− | ,a.[AddressLine2]
| |
− | ,a.[City]
| |
− | ,[StateProvinceName] = sp.[Name]
| |
− | ,a.[PostalCode]
| |
− | ,[CountryRegionName] = cr.[Name]
| |
− | ,[TerritoryName] = st.[Name]
| |
− | ,[TerritoryGroup] = st.[Group]
| |
− | ,s.[SalesQuota]
| |
− | ,s.[SalesYTD]
| |
− | ,s.[SalesLastYear]
| |
− | FROM [Sales].[SalesPerson] s
| |
− | INNER JOIN [HumanResources].[Employee] e
| |
− | ON e.[EmployeeID] = s.[SalesPersonID]
| |
− | LEFT OUTER JOIN [Sales].[SalesTerritory] st
| |
− | ON st.[TerritoryID] = s.[TerritoryID]
| |
− | INNER JOIN [Person].[Contact] c
| |
− | ON c.[ContactID] = e.[ContactID]
| |
− | INNER JOIN [HumanResources].[EmployeeAddress] ea
| |
− | ON e.[EmployeeID] = ea.[EmployeeID]
| |
− | INNER JOIN [Person].[Address] a
| |
− | ON ea.[AddressID] = a.[AddressID]
| |
− | INNER JOIN [Person].[StateProvince] sp
| |
− | ON sp.[StateProvinceID] = a.[StateProvinceID]
| |
− | INNER JOIN [Person].[CountryRegion] cr
| |
− | ON cr.[CountryRegionCode] = sp.[CountryRegionCode];
| |
− | </pre>
| |
− |
| |
− | === References ===
| |
− | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
| |
− | |- style="background:silver"
| |
− | | '''Dependency Type
| |
− | | '''Object Type
| |
− | | '''Referenced Object
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[HumanResources.Employee_(table)|HumanResources.Employee]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.Address_(table)|Person.Address]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.Contact_(table)|Person.Contact]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.CountryRegion_(table)|Person.CountryRegion]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.StateProvince_(table)|Person.StateProvince]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Sales.SalesPerson_(table)|Sales.SalesPerson]]
| |
− |
| |
− | |- valign="top"
| |
− | | Select
| |
− | | Table
| |
− | | [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]]
| |
− |
| |
− | |- valign="top"
| |
− | | Schema
| |
− | | Schema
| |
− | | [[Sales_(schema)|Sales]]
| |
− |
| |
− | |}
| |
− |
| |
− |
| |
− | == automatically generated ==
| |
| | | |
| {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |
Line 114: |
Line 5: |
| | '''view | | | '''view |
| | Sales.vSalesPerson | | | Sales.vSalesPerson |
− | |- valign="top"
| |
− | | '''Description
| |
− | | Sales representiatives (names and addresses) and their sales-related information.
| |
| |- | | |- |
| |} | | |} |
| | | |
| <pre> | | <pre> |
− |
| |
| CREATE VIEW [Sales].[vSalesPerson] | | CREATE VIEW [Sales].[vSalesPerson] |
| AS | | AS |
Line 162: |
Line 49: |
| ON cr.[CountryRegionCode] = sp.[CountryRegionCode]; | | ON cr.[CountryRegionCode] = sp.[CountryRegionCode]; |
| </pre> | | </pre> |
− |
| |
− |
| |
− | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
| |
− | |- style="background:silver"
| |
− | | '''Dependency Type
| |
− | | '''Object Type
| |
− | | '''Referenced Object
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[HumanResources.Employee_(table)|HumanResources.Employee]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[HumanResources.EmployeeAddress_(table)|HumanResources.EmployeeAddress]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.Address_(table)|Person.Address]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.Contact_(table)|Person.Contact]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.CountryRegion_(table)|Person.CountryRegion]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Person.StateProvince_(table)|Person.StateProvince]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Sales.SalesPerson_(table)|Sales.SalesPerson]]
| |
− |
| |
− | |-
| |
− | | Select
| |
− | | Table
| |
− | | [[Sales.SalesTerritory_(table)|Sales.SalesTerritory]]
| |
− |
| |
− | |-
| |
− | | Schema
| |
− | | Schema
| |
− | | [[Sales_(schema)|Sales]]
| |
− |
| |
− | |}
| |