sum不能用到两个表中吗?
合计出的数据不对
SELECT SUM(a.a) AS AA, SUM(b.b) AS BB
FROM a,b
------解决方案--------------------SELECT SUM(a.a) AS AA, SUM(b.b) AS BB
FROM a,b
===============
你这是计算的笛卡尔积,当然不对了,应该加上关联条件,即:
SELECT SUM(a.a) AS AA, SUM(b.b) AS BB
FROM a,b
where a.主键=b.主键
------解决方案----------------------try
select
AA=(select sum(a) from a),
BB=(select sum(b) from b)