2 つの一時テーブルを内部結合しようとして
います これが実行できることはわかっていますが、以前に実行したことがありますが、その方法を完全に忘れていました
アドバイスしてください
以下は実行しようとするクエリです
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
これは失敗し
ます I think I am not allowed to use tmp1 in the subquery that create tmp2
メッセージ 4104、レベル 16、状態 1、行 17 マルチパート識別子 "tmp1.IdPlayer" をバインドできませんでした。