***帮助****这可能是重复的,但我已经找到答案了,无法得出任何结果。我这样做只是为了寻求一点帮助...
基本上,我有一个查询可以产生我的行排名,并且效果很好,但是我无法按地址排名进行过滤...
寻找一排。任何帮助,将不胜感激。结果:
Andress rank aDDRESS PO.primOffInd pIDKEY
1 100 N WEST Y 1
2 300 N WEST N 1
3 500 N WEST N 1
4 600 WEST N 1
想要:下面的代码给我地址等级和4行,我需要下面显示的内容。这是用于行的,所以我希望能够按地址等级进行过滤
Address rank Address PO.primOffInd Pikdey
1 100 N WEST Y 1
SELECT *
FROM
(
SELECT DISTINCT RANK() OVER
(PARTITION BY A, PO ORDER BY PO, A, i, c, d, l, UI.UNIQUEID) AS AddressRank /* actual column names were obfuscated for security considerations */
... /* the rest of the query minus the order by clause */
) as T
where AddressRank = 1
order by uniqueId desc /* ui is not a valid alias here so I removed it */
顺便说一句,我假设您希望查询中的其他列可用。我不认为DISTINCT会增加任何值,因为(我收集到)排名列可能使所有行都是唯一的。我建议将其删除。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句