IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_employees]') AND type = 'V')
DROP VIEW [dbo].[mps_employees]
GO

create view mps_employees as 
select 
cu_id,
cu_cmpid,
cu_bcid,
cu_branch,
cu_dpid,
cu_depart,
cu_fastkey,
cu_code,
cu_account,
cu_star,
cu_gender,
cu_security,
cu_function,
cu_managelevel,
cu_professionlevel,
cu_otlevel,
cu_name,
cu_mobile,
cu_contact,
cu_nation,
cu_address,
cu_post,
cu_position,
cu_qq,
cu_identtype,
cu_identno,
cu_email,
cu_otid,
cu_title,
cu_dpid2,
cu_depart2,
cu_otid2,
cu_title2,
cu_dpid3,
cu_depart3,
cu_otid3,
cu_title3,
cu_duty,
cu_party,
cu_origin,
cu_academic,
cu_height,
cu_major,
cu_college,
cu_graduate,
cu_degrees,
cu_marriage,
cu_entrytime,
cu_dimission,
cu_salary,
cu_status,
cu_login,
cu_icon,
cu_sign,
cu_birth,
cu_use 
from mps_employee 
union 
select 
a.cu_id,
a.cu_cmpid,
b.lgu_bcid cu_bcid,
b.lgu_branch  cu_branch,
b.lgu_dpid cu_dpid,
b.lgu_depart cu_depart,
a.cu_fastkey,
a.cu_code,
a.cu_account,
a.cu_star,
a.cu_gender,
a.cu_security,
a.cu_function,
a.cu_managelevel,
a.cu_professionlevel,
a.cu_otlevel,
a.cu_name,
a.cu_mobile,
a.cu_contact,
a.cu_nation,
a.cu_address,
a.cu_post,
a.cu_position,
a.cu_qq,
a.cu_identtype,
a.cu_identno,
a.cu_email,
b.lgu_otid cu_otid,
b.lgu_title cu_title,
a.cu_dpid2,
a.cu_depart2,
a.cu_otid2,
a.cu_title2,
a.cu_dpid3,
a.cu_depart3,
a.cu_otid3,
a.cu_title3,
a.cu_duty,
a.cu_party,
a.cu_origin,
a.cu_academic,
a.cu_height,
a.cu_major,
a.cu_college,
a.cu_graduate,
a.cu_degrees,
a.cu_marriage,
a.cu_entrytime,
a.cu_dimission,
a.cu_salary,
a.cu_status,
a.cu_login,
a.cu_icon,
a.cu_sign,
a.cu_birth,
a.cu_use
from mps_employee a,mps_login_role b
where a.cu_id=b.lgu_cuid