select sum(t.factivitiescount) as factivitiescount,
       sum(t.fsharecount)      as fsharecount,
       sum(t.fcustcount)       as fcustcount,
       sum(t.fformcount)       as fformcount,
       sum(t.fagentcount)      as fagentcount,
       sum(t.famount)          as famount
from (
         select count(distinct tagentactivitiesid) as factivitiescount,--参与活动数
                count(tagentactivities_shareid)    as fsharecount,--分享次数
                0                                  as fcustcount,--流量，阅读人数
                0                                  as fformcount,--线索，意向客户数
                0                                  as fagentcount,--合作商家数
                0                                  as famount--奖励金额
         from tagentactivities_share t1
         where t1.fsaler2id = $tenterprise_userid$
         union all
select 0                 as factivitiescount,
       0                 as fsharecount,
       sum(t1.fvisitors) as fcustcount,
       0                 as fformcount,
       0                 as fagentcount,
       SUM(t1.famount)   as famount
from tagentactivities_cust t1
         inner join tagentactivities_share t2
                    on t1.siteid = t2.siteid and t1.tagentactivitiesid = t2.tagentactivitiesid and
                       t1.tagentactivities_shareid = t2.tagentactivities_shareid
where t2.fsaler2id = $tenterprise_userid$
union all
select 0            as factivitiescount,
       0            as fsharecount,
       0            as fcustcount,
       count(0)     as fformcount,
       0            as fagentcount,
       SUM(famount) as famount
from tagentactivities_form t1
         inner join tagentactivities_share t2
                    on t1.siteid = t2.siteid and t1.tagentactivitiesid = t2.tagentactivitiesid and
                       t1.tagentactivities_shareid = t2.tagentactivities_shareid
where t2.fsaler2id = $tenterprise_userid$
union all
select 0                         as factivitiescount,
       0                         as fsharecount,
       0                         as fcustcount,
       0                         as fformcount,
       count(distinct tagentsid) as fagentcount,
       0                         as famount
from TPROMOTERS
where fsaler2id = $tenterprise_userid$

    ) t