1 SELECT mc,SUM(s1) FROM 2 ( 3 SELECT 4 [mc],(-[s1]) as s1 5 FROM AAA 6 UNION ALL 7 SELECT 8 [mc],[s1] as s1 9 FROM BBB) List 10 GROUP BY mc
没测试。应该没问题
select mc ,s1-(select sum(s1) from bbb where mc=aaa.mc group by mc) from aaa
谢谢啊!
这个写法听高级的,是个新的知识点!这个知识点的名字叫什么啊?谢谢!