Difference between revisions of "HumanResources.vEmployeeDepartmentHistory (view)"
Line 3: | Line 3: | ||
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
|- | |- | ||
− | | ''' | + | | '''View |
| HumanResources.vEmployeeDepartmentHistory | | HumanResources.vEmployeeDepartmentHistory | ||
|- valign="top" | |- valign="top" | ||
Line 11: | Line 11: | ||
|} | |} | ||
+ | |||
+ | === Source === | ||
<pre> | <pre> | ||
CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] | CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] | ||
Line 37: | Line 39: | ||
</pre> | </pre> | ||
− | + | === References === | |
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
|- style="background:silver" | |- style="background:silver" | ||
Line 68: | Line 70: | ||
| Table | | Table | ||
| [[Person.Contact_(table)|Person.Contact]] | | [[Person.Contact_(table)|Person.Contact]] | ||
+ | |||
+ | |- | ||
+ | | Schema | ||
+ | | Schema | ||
+ | | [[HumanResources_(schema)|HumanResources]] | ||
|} | |} | ||
− | |||
Revision as of 23:07, 2 February 2010
wikibot
View | HumanResources.vEmployeeDepartmentHistory |
Description | Returns employee name and current and previous departments. |
Source
CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] AS SELECT e.[EmployeeID] ,c.[Title] ,c.[FirstName] ,c.[MiddleName] ,c.[LastName] ,c.[Suffix] ,s.[Name] AS [Shift] ,d.[Name] AS [Department] ,d.[GroupName] ,edh.[StartDate] ,edh.[EndDate] FROM [HumanResources].[Employee] e INNER JOIN [Person].[Contact] c ON c.[ContactID] = e.[ContactID] INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] INNER JOIN [HumanResources].[Department] d ON edh.[DepartmentID] = d.[DepartmentID] INNER JOIN [HumanResources].[Shift] s ON s.[ShiftID] = edh.[ShiftID];
References
Dependency Type | Object Type | Referenced Object |
Select | Table | HumanResources.Department |
Select | Table | HumanResources.Employee |
Select | Table | HumanResources.EmployeeDepartmentHistory |
Select | Table | HumanResources.Shift |
Select | Table | Person.Contact |
Schema | Schema | HumanResources |
automatically generated
view | HumanResources.vEmployeeDepartmentHistory |
Description | Returns employee name and current and previous departments. |
CREATE VIEW [HumanResources].[vEmployeeDepartmentHistory] AS SELECT e.[EmployeeID] ,c.[Title] ,c.[FirstName] ,c.[MiddleName] ,c.[LastName] ,c.[Suffix] ,s.[Name] AS [Shift] ,d.[Name] AS [Department] ,d.[GroupName] ,edh.[StartDate] ,edh.[EndDate] FROM [HumanResources].[Employee] e INNER JOIN [Person].[Contact] c ON c.[ContactID] = e.[ContactID] INNER JOIN [HumanResources].[EmployeeDepartmentHistory] edh ON e.[EmployeeID] = edh.[EmployeeID] INNER JOIN [HumanResources].[Department] d ON edh.[DepartmentID] = d.[DepartmentID] INNER JOIN [HumanResources].[Shift] s ON s.[ShiftID] = edh.[ShiftID];
Dependency Type | Object Type | Referenced Object |
Select | Table | HumanResources.Department |
Select | Table | HumanResources.Employee |
Select | Table | HumanResources.EmployeeDepartmentHistory |
Select | Table | HumanResources.Shift |
Select | Table | Person.Contact |
Schema | Schema | HumanResources |