Select
T.TeamName,
Count(TeamID) As CountB,
(Select Count(*) From C Where TableName='A' And BelongID=T.PkID)
+(Select Count(*) From C Where TableName='B' And BelongID=(Select PkID From B Where TeamID=T.PkID))
From A T
Left Join B
On T.PkID=B.TeamID
Group By T.TeamName
Select
T.TeamName,
Count(TeamID) As CountB,
(Select Count(*) From C Where TableName='A' And BelongID=T.PkID)
+(Select Count(*) From C Where TableName='B' And BelongID=(Select PkID From B Where TeamID=T.PkID))
From A T
Left Join B
On T.PkID=B.TeamID
Group By T.TeamName