View: dbo.Employee_N_Employee_Reporting_Type_View
View definition
-- This view is created to handle the Employee Reporting Type filter
-- and it is related to the Employee_Reporting_View with the help of employee_reporting_type_KEY
-- where the columns of this view is defined for lookup values
create view dbo.Employee_N_Employee_Reporting_Type_View as
select * from (select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.is_family_of_owner = 1 Then 1
End
from Employee
Union
select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.is_officer = 1 Then 2
End
from Employee
Union
select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.is_part_time = 1 Then 3
End
from Employee
Union
select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.is_probationary = 1 Then 4
End
from Employee
Union
select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.is_seasonal = 1 Then 5
End
from Employee
Union
select employee_KEY = Employee.employee_KEY,
employee_reporting_type_KEY = Case When Employee.has_health_care = 0 Then 6
End
from Employee) e where e.employee_reporting_type_KEY is not null