Difference between revisions of "HumanResources.vEmployeeDepartment (view)"
(New page: == wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''view | HumanResources.vEmployeeDepartment |- |} <pre> CREATE VIEW [HumanResources].[v...) |
|||
| Line 9: | Line 9: | ||
<pre> | <pre> | ||
| + | CREATE VIEW [HumanResources].[vEmployeeDepartment] | ||
| + | AS | ||
| + | SELECT | ||
| + | e.[EmployeeID] | ||
| + | ,c.[Title] | ||
| + | ,c.[FirstName] | ||
| + | ,c.[MiddleName] | ||
| + | ,c.[LastName] | ||
| + | ,c.[Suffix] | ||
| + | ,e.[Title] AS [JobTitle] | ||
| + | ,d.[Name] AS [Department] | ||
| + | ,d.[GroupName] | ||
| + | ,edh.[StartDate] | ||
| + | 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] | ||
| + | WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE()); | ||
| + | </pre> | ||
| + | |||
| + | == automatically generated == | ||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" | ||
| + | |- | ||
| + | | '''view | ||
| + | | HumanResources.vEmployeeDepartment | ||
| + | |- | ||
| + | |||
| + | | '''Description | ||
| + | | Returns employee name, title, and current department. | ||
| + | |- | ||
| + | |||
| + | |} | ||
| + | |||
| + | <pre> | ||
| + | |||
CREATE VIEW [HumanResources].[vEmployeeDepartment] | CREATE VIEW [HumanResources].[vEmployeeDepartment] | ||
AS | AS | ||
Revision as of 23:28, 26 November 2009
wikibot
| view | HumanResources.vEmployeeDepartment |
CREATE VIEW [HumanResources].[vEmployeeDepartment]
AS
SELECT
e.[EmployeeID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,e.[Title] AS [JobTitle]
,d.[Name] AS [Department]
,d.[GroupName]
,edh.[StartDate]
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]
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());
automatically generated
| view | HumanResources.vEmployeeDepartment |
| Description | Returns employee name, title, and current department. |
CREATE VIEW [HumanResources].[vEmployeeDepartment]
AS
SELECT
e.[EmployeeID]
,c.[Title]
,c.[FirstName]
,c.[MiddleName]
,c.[LastName]
,c.[Suffix]
,e.[Title] AS [JobTitle]
,d.[Name] AS [Department]
,d.[GroupName]
,edh.[StartDate]
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]
WHERE GETDATE() BETWEEN edh.[StartDate] AND ISNULL(edh.[EndDate], GETDATE());