SELECT d.Name as Dept, s.Name as Shift, e.EmployeeID as EmployeeID
FROM (HumanResources.Department d
INNER JOIN HumanResources.EmployeeDepartmentHistory e
ON d.DepartmentID = e.DepartmentID)
INNER JOIN HumanResources.Shift s
ON e.ShiftID = s.ShiftID
如果查询未返回所需的数据,则说明您可能正在使用 AdventureWorks 的早期版本。 有关安装 AdventureWorks 的 SQL Server 2005 版本的更多信息,请参见演练:安装 AdventureWorks 数据库。