两个查询结果能否合并(union)后再sum,group by?
源:
(SELECT jjk,sum(jn1) as a1 from b_jj where jcyear='2004' and jcmonth='12' group by jjk ) union
(SELECT hjk,sum(hn1) as a1 from b_hc where hcyear='2004' and hcmonth='12' group by hjk)
目的:
select aa.jjk,sum(a1) from (源) as aa group by aa.jjk
我在access2000里试验,提示join 语句出错.
各位,通过一条sql语句实现有什么办法?