sql server两行相减
sql server两行相减
公式:
select a.qty-b.qty
from tableA a,tableB b
where a.number=b.number
不同步表行相减:
select a.month1-b.month1 ,a.month2-b.month2,a.month3-b.month3,a.month4-b.month4,a.month5-b.month5,a.month6-b.month6,
a.month7-b.month7,a.month8-b.month8,a.month9-b.month9,a.month10-b.month10,a.month11-b.month11,a.month12-b.month12,a.lastYear-b.lastYear,a.qianYear-b.qianYear,'','','','',0, a.sumqty-b.sumqty
from GouJinZiZhiTongJiTable1 a,GouJinZiZhiTongJiTable2 b
where a.rowid=b.rowid
同一张表两不同行同一月份进行相减:
select a.month1-b.month1 ,a.month2-b.month2,a.month3-b.month3,a.month4-b.month4,a.month5-b.month5,a.month6-b.month6,
a.month7-b.month7,a.month8-b.month8,a.month9-b.month9,a.month10-b.month10,a.month11-b.month11,a.month12-b.month12,a.lastYear-b.lastYear,a.qianYear-b.qianYear,'','','','',0, a.sumqty-b.sumqty
from GouJinZiZhiTongJiTable2 a,GouJinZiZhiTongJiTable2 b
where a.pm='折合标准张合计' and b.pm='Total'
1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » sql server两行相减
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » sql server两行相减
发表评论