--use [AdventureWorksDW2012] [dbo].[DimEmployee]
--show list of Employees in other Department that have the same baseRate AS Employees in Information Services department
--only show records with baseRatee >30
--list Employee's DepartmentName,EmployeeKey,baseRate,FirstName,LastName, AND the DepartmentName,EmployeeKey,baseRate,FirstName,LastName of same base rate Employees who are
--in Information Services department ,it is to compare Side-by-Side

use [AdventureWorksDW2012]
go
select distinct D1.DepartmentName AS 'Employee''s DepartmentName',D1.EmployeeKey,D1.BaseRate,D1.FirstName,D1.LastName
from [dbo].[DimEmployee]D1,[dbo].[DimEmployee]D2
where D1.[ParentEmployeeKey]=D2.[EmployeeKey] and D1.BaseRate>30
and d1.DepartmentName <>'Information Services'
order by 3
select distinct D1.DepartmentName AS 'Employee''s DepartmentName',D1.EmployeeKey,D1.BaseRate,D1.FirstName,D1.LastName
from [dbo].[DimEmployee]D1,[dbo].[DimEmployee]D2
where D1.[ParentEmployeeKey]=D2.[EmployeeKey] and D1.BaseRate>30
and d1.DepartmentName = 'Information Services'
order by 3
go
select distinct D1.DepartmentName AS 'Employee''s DepartmentName',D1.EmployeeKey,D1.BaseRate,D1.FirstName,D1.LastName
from [dbo].[DimEmployee]D1,[dbo].[DimEmployee]D2
where D1.[ParentEmployeeKey]=D2.[EmployeeKey] and D1.BaseRate>30
and d1.DepartmentName <>'Information Services'
order by 3
select distinct D1.DepartmentName AS 'Employee''s DepartmentName',D1.EmployeeKey,D1.BaseRate,D1.FirstName,D1.LastName
from [dbo].[DimEmployee]D1,[dbo].[DimEmployee]D2
where D1.[ParentEmployeeKey]=D2.[EmployeeKey] and D1.BaseRate>30
and d1.DepartmentName = 'Information Services'
order by 3