select a.email, 
a.tel,
a.nickName,
b.email as parentEmail,
count(b.userid) as InviteCount,
count(EventID) as  EventCount,
count(IntegralID) as IntegralCount
from  userinfo a 
join userinfo b on b.userid=a.parentid
join Event c on c.Userid=a.userid
join Integral d on d.UserID=a.userid 
where 1=1
and a.email='[email protected]'

解决方案 »

  1.   

    select a.email, 
        a.tel,
        a.nickName,
        b.email as parentEmail,
        count(b.userid) as InviteCount,
        count(EventID) as  EventCount,
        count(IntegralID) as IntegralCount
    from  userinfo a 
    join userinfo b on b.userid=a.parentid
    join Event c on c.Userid=a.userid
    join Integral d on d.UserID=a.userid 
    where 1=1
    and a.email='[email protected]'
    group by a.email, 
        a.tel,
        a.nickName,
        b.email
      

  2.   


    得出的结果不对啊!
    [email protected] 15919190809 灰鸽子 [email protected] 33 28 58
    [email protected] 15919190809 灰鸽子 [email protected] 1624 1624 1624你的多了这么多数据,汗!