0
我有两个表格,我想查找两个表格记录的总和以及每个表格的总和。这里是我的查询,它给了我两个正确的总和。每个表格的总和和个人表格的总和
select sum(tot_live) as tot_live
from (select count(id) as tot_live from crm_rentals where status = 2 and is_active=1 and is_archive=0
union
select count(id) as tot_live from crm_sales where status = 2 and is_active=1 and is_archive=0) s
这给我tot_live = 300
现在我想告诉每一个像300 = 100和200
tot_live | table1 |table2
300 100 200
这已经为tot_live工作,我需要每个表的计数也 – user3244721
你甚至尝试过这种解决方案,user3244721? – Martin
它给我这个问题在'字段列表'中的未知列'table2' – user3244721