我有一个查询,我试图在 SSRS 中创建一个数据集,但我收到一条错误消息,
The OVER SQL construct or statement is not supported.
我正在使用的查询如下:
SELECT AM, REP, PRIM_SPEC, SUM(TOT_CALL)
FROM (
SELECT AM, REP, SUM(TOT_CALL) as TOT_CALL,
CASE
WHEN ROW_NUMBER() OVER (PARTITION BY REP ORDER BY SUM(TOT_CALL) DESC) > 5
THEN 'Other'
ELSE prim_spec
END AS prim_spec
FROM DEMO_CALL
WHERE PERIOD >= @Mese
AND (REP IN (@REP))
AND (AM = @AM)
GROUP BY AM, REP, prim_spec
) A
GROUP BY AM, REP, PRIM_SPEC
ORDER BY 1,2,4 DESC
我如何使用我的 OVER SQL 构造来解决这个问题?