select ta.mdmc,ta.loudong,ta.louceng,ta.quyu,ta.spid,ta.spmc,tb.xszje,tc.xsjedr from(select * from zg_sysinfo )ta left join (select mdmc,loudong,louceng,quyu,spid,spmc,sum(xsbs)xsbs,sum(xszje)xszje from sale_daily where rq>='2022-12-1' and rq<='2022-12-1' group by mdmc,loudong,louceng,quyu,spid,spmc) tb on ta.mdmc=tb.mdmc and ta.louceng=tb.louceng and ta.spid=tb.spid left join (select mdmc,louceng,spid,sum(xsbs) xsbsdr,sum(xsje) xsjedr from sale_sprl where rq>='2022-12-1' and rq<='2022-12-1' group by mdmc,louceng,spid) tc on ta.mdmc=tc.mdmc and ta.louceng=tc.louceng and ta.spid=tc.spid 我有一张基础表,外加两张数据表,关键起来的查询,日期条件相同。我想把这段当成基础表,不要每次都写,后面直接加WHERE 就行。这要怎么实现,用视图吗?应该怎么写。存储过程可以通过参数出结果,但是不能加WHERE,不能当成基础表来用,请大神指点。