我正在尝试内部加入 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
这将失败,
我认为我不允许在创建 tmp2 的子查询中使用 tmp1
消息 4104,级别 16,状态 1,第 17 行 无法绑定多部分标识符“tmp1.IdPlayer”。