SELECT e.id AS id,e.age AS age,e.bmgw_id AS bmgwId,b.`name` AS gw,bb.`name` AS bm, p.`name` AS proname,d.`name` AS eduname,e.job_status AS jobStatus,datediff(CURDATE(),e.rz_time) AS workage
FROM yggl_main_emp e
LEFT JOIN zzgl_bmgw_m b ON b.id = e.bmgw_id
LEFT JOIN zzgl_bmgw_m bb ON bb.id = b.up_id
LEFT JOIN province_class p ON left (e.`jg`,2) = p.province