说明:
MBGL_GZJH jh_id 对应 mbgl_gzjh_fkmx jh_id
mbgl_gzjh_fkmx jh_id 有重复多条,但是 FKRQ 不一样,我们去 FKRQ 最新的一条。
select * FROM MBGL_GZJH A
LEFT JOIN
(select BC.* from (select max(FKRQ) as maxrq,JH_ID from mbgl_gzjh_fkmx GROUP BY JH_ID ) AC
LEFT JOIN mbgl_gzjh_fkmx BC on AC.maxrq = BC.FKRQ and AC.JH_ID = BC.JH_ID)
fk ON A.jh_id = fk.JH_ID