select distinct a1,a2,sum(a3) from
(select a1,a2,a3 from table1
union all select a1,a2,a3
from table1)
group by a1,a2
...全文
508打赏收藏
sql语句的问题!
table1(a1,a2,a3) table2(a1,a2,a3) select distinct a1,a2,sum(a3) from (select a1,a2,a3 from table1 union all select a1,a2,a3 from table1) group by a1,a2