KSQL语句如下:
select ER_GJGZXXB.*
,case when ER_GJGZZD_BASE.fGJGZMC is null then ER_WLZDZB.fWLMC else ER_GJGZZD_BASE.fGJGZMC end as mc
from ER_GJGZXXB ER_GJGZXXB
optional join ER_GJGZZD_BASE ER_GJGZZD_BASE on ER_GJGZZD_BASE.fGJGZBH = ER_GJGZXXB.fWLBH
optional join ER_WLZDZB ER_WLZDZB on ER_WLZDZB.fWLBM = ER_GJGZXXB.fWLBH