Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Department Employees(by department) Male(By department) Female(by department)
- Employee 11 6 5
- Management 10 5 5
- Owner 1 1 0
- SELECT [tbDepartment].[DepartmentName] AS [Department name],
- Count(*) AS [Number of employees by department type],
- (Select Count([EmployeeGender]) FROM [tbEmployee] WHERE [EmployeeGender] = 'Male' AND [DepartmentName] = [tbDepartment].[DepartmentName]) AS [Number of male employees by department type],
- (Select Count([EmployeeGender]) FROM [tbEmployee] WHERE [EmployeeGender] = 'Female' AND [DepartmentName] = [tbDepartment].[DepartmentName]) AS [Number of female employees by department type]
- FROM [tbEmployee] JOIN [tbDepartment]
- ON [tbEmployee].[DepartmentId] = [tbDepartment].[DepartmentId]
- GROUP BY [tbDepartment].[DepartmentName];
- Department Employees(by department) Male(By department) Female(by department)
- Employee 11 12 10
- Management 10 12 10
- Owner 1 12 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement