select d.* from (select a.requestid, a.depmentname , a.operatorname , c.amount aout, c.paytype , a.billdate bdate from oa_fund_plan_out c left JOIN (select REQUESTID,depmentname,operatorname,billdate from oa_fund_plan ) a ON c.requestid = a.requestid UNION all select a.requestid, a.depmentname , a.operatorname , b.amount ain, b.colltype , a.billdate bdate from oa_fund_plan_in b left JOIN (select REQUESTID,depmentname,operatorname,billdate from oa_fund_plan ) a ON b.requestid = a.requestid) d where d.bdate='2021-06-23'