日期:2014-05-17 浏览次数:20493 次
DECLARE @sql VARCHAR(8000),@str VARCHAR(4000) SET @sql=' SELECT * FROM (SELECT a.BelongBranchID,e.CustomerName 客户名称,f.ProjectName 服务规则,b.EmName 姓名,c.TitleCN 证件类型,b.IdCardCode 证件号码,d.TitleCN 性别,b.Birthday 生日 ,a.JoinDate 入职日期, a.BusinessMode 模式,a.WorkCityID 工作城市,a.EmDepartment 部门,b.ResidenceAddress 户籍地址,b.ContactAddress 现居住地址,a.Remark 备注,b.ContactMobilePhone 联系方式 FROM tb_masEmployeeEmployer a join tb_masEmPersonalInfo b ON a.EmPersonalInfoID = b.EmPersonalInfoID and b.Disabled=0 left join tb_refCardType c ON b.CardTypeID = c.CardTypeID and c.Disabled=0 left join tb_refGender d ON b.GenderID = d.GenderID and d.Disabled=0 join tb_masCustomer e ON a.CustomerID=e.CustomerID and e.Disabled=0 left join tb_masProject f ON a.ServiceRuleID=f.ProjectID and f.Disabled=0 WHERE 1=1 AND a.Disabled = 0 and (1 = 0 or a.EwStatus = ''N'' or a.EwStatus = ''A'' or a.EwStatus is null )and a.CustomerID IN ('+@str+')) a WHERE BelongBranchID in (1,61)' EXEC (@sql)