SQL Query运行一个选择查询足球联赛表

时间:2015-12-07 00:31:31

标签: c# sql asp.net-mvc

这是我的查询。我有一个colomun名字" Played" (INT)。如果匹配播放,我将其更新为一个。所以稍后再说。现在我想要一个团队为这个查询玩的一些比赛。但我不知道如何添加它。

Select  DENSE_RANK() OVER(order by Point DESC,GD DESC) as Rank, * from (select  TName, Sum(Score) as Score, Sum(GA) as GA,Sum(Diff) as GD,Sum(Point) as Point from  (Select f.teamID,Score as Score, GA as GA,Score-GA as DIff,
case 
when Result = 'W' then 3
when Result = 'D' then 1
Else 0
end as Point, T.TName, 
from Fixtures F
inner join  Teams T on t.TeamID = f.TeamID  ) S
group by teamID,TName) SS
order by Point DESC,GD DESC

1 个答案:

答案 0 :(得分:0)

对结果进行计数。这会得到他们玩了多少场比赛