SQL sever 中把这两个查询语句合并成一个

发布时间:2019-09-20 12:53:58

SQL sever 中把这两个查询语句合并成一个

推荐回答

前边的不变,where 后用or连接

select fitemid, recInNum, recOutNum  from (select t1.fitemid, t1.fqty as recInNum          from icstockbillentry t1          left join icstockbill t2 on t1.finterid = t2.finterid         where t2.fbillno like 'WIN%') a  left join (select t1.fitemid, t1.fqty as recOutNum               from icstockbillentry t1               left join icstockbill t2 on t1.finterid = t2.finterid              where t2.fbillno like 'SOUT%') b on a.fitemid = b.fitemid
以上问题属网友观点,不代表本站立场,仅供参考!