Difference between revisions of "HumanResources.vEmployeeDepartmentHistory (view)"

From dbscript Online Help
Jump to: navigation, search
Line 33: Line 33:
 
     ON s.[ShiftID] = edh.[ShiftID];
 
     ON s.[ShiftID] = edh.[ShiftID];
 
</pre>
 
</pre>
 
 
== automatically generated ==
 
== automatically generated ==
  
Line 74: Line 73:
 
     ON s.[ShiftID] = edh.[ShiftID];
 
     ON s.[ShiftID] = edh.[ShiftID];
 
</pre>
 
</pre>
 +
 +
 +
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 +
|- style="background:silver"
 +
| '''Referenced Object
 +
| '''Object Type
 +
| '''Dependency Type
 +
 +
|-
 +
| [[HumanResources.Department_(table)|HumanResources.Department]]
 +
| Table
 +
| Select
 +
|-
 +
| [[HumanResources.Employee_(table)|HumanResources.Employee]]
 +
| Table
 +
| Select
 +
|-
 +
| [[HumanResources.EmployeeDepartmentHistory_(table)|HumanResources.EmployeeDepartmentHistory]]
 +
| Table
 +
| Select
 +
|-
 +
| [[HumanResources.Shift_(table)|HumanResources.Shift]]
 +
| Table
 +
| Select
 +
|-
 +
| [[Person.Contact_(table)|Person.Contact]]
 +
| Table
 +
| Select
 +
|}

Revision as of 23:59, 26 November 2009

wikibot

view HumanResources.vEmployeeDepartmentHistory
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];

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];


Referenced Object Object Type Dependency Type
HumanResources.Department Table Select
HumanResources.Employee Table Select
HumanResources.EmployeeDepartmentHistory Table Select
HumanResources.Shift Table Select
Person.Contact Table Select