我試圖內加入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」無法綁定。