看起来使用over子句,从而创建一个"窗口函数",将聚合函数与select语句分开.
SELECT Distinct [DataPoint], MIN([Value]) OVER (PARTITION BY [DataPoint]) AS [Value MIN], MAX([Value]) OVER (PARTITION BY [DataPoint]) AS [Value MAX], AVG([Value]) OVER (PARTITION BY [DataPoint]) AS [Value AVG], PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY [Value]) OVER (PARTITION BY [DataPoint]) AS MedianCont FROM [Table] AS [Table] WHERE ([DataPoint] IN ( ... ) )