Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的选择之一以:
DENSE_RANK() OVER(ORDER BY a.distance, a.state || a.idnum, a.taxid, a.location) row_num
给结果集一个行号,会有重复。
我想知道如何在同一个选择中使用类似或相关的语句来包含一个字段highest_row_num 来获取由上述语句创建的所有row_num 字段中的最高的一个。任何的想法?
你可以这样做:
select v.*, max(row_num) over () as max_row_num from ( select ..., DENSE_RANK() OVER(ORDER BY a.distance, a.state || a.idnum, a.taxid, a.location) row_num from ... )