我试图内加入2个临时表
我知道这是可以做到的,我以前做过,但我完全忘了该怎么办呢
请
告诉我下面是,我试图执行
帮助与SQL 2005和内部连接
select tmp1.*, tmp2.cnt from
(
select
1 as ClassificationType,
tblMatches.IdGame,
tblMatches.IdPlayer,
sum(Score) as Score, sum(Points) as Points, sum(OpponentScore) as OpponentScore,
count(ID) as MatchesCount, count(distinct IdCompetition) as CompetitionsCount
from
tblMatches
group by IdPlayer, IdGame
) as tmp1
inner join (select IdWinner, count(IdWinner) as cnt from tblCompetitions where IdWinner = tmp1.IdPlayer) as tmp2
on tmp2.IdWinner = tmp1.IdPlayer
这将失败,并
我想我不允许在创建TMP2
Msg 4104,Level 16,State 1,Line 17 多部分标识符 “tmp1.IdPlayer”无法绑定。