left join t_pre_employee_info e on a.id=e.PRE_MAIN_ID
left join t_pre_emp_family ef on a.id=ef.PRE_MAIN_ID
left join view_sys_dict_item family_relation on family_relation.value=ef.RELATIONSHIP_SELF and family_relation.type='family_relation'
<where>
a.STATUS != '5' and ef.id is not null and EXISTS (
select 1 from (select a.EMP_IDCARD from t_pre_emp_family a left join t_pre_emp_main p on a.PRE_MAIN_ID=p.id where p.STATUS != '5' and p.id is not null GROUP BY a.EMP_IDCARD HAVING count(1)>1) ea where ea.EMP_IDCARD=ef.EMP_IDCARD
,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51,ep.DECLARE_YEAR field52,qualification_type.label field53
,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51,ep.DECLARE_YEAR field52,ep.QUALIFICATION_TYPE field53
FROM t_pre_emp_main a
left join t_pre_employee_info e on a.id=e.PRE_MAIN_ID
left join t_pre_emp_professional_qualification ep on a.id=ep.PRE_MAIN_ID
left join view_sys_dict_item qualification_type on qualification_type.value=ep.QUALIFICATION_TYPE and qualification_type.type='qualification_type'
<where>
a.STATUS != '5' and ep.id is not null and EXISTS (
select 1 from (select a.EMP_IDCARD from t_pre_emp_professional_qualification a left join t_pre_emp_main p on a.PRE_MAIN_ID=p.id where p.STATUS != '5' and p.id is not null GROUP BY a.EMP_IDCARD HAVING count(1)>1) ea where ea.EMP_IDCARD=ep.EMP_IDCARD