问题标签 [dense-rank]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sql - 找到那些没有禁止条件的 id-s
我有一些条件“更简单”的子选择,但这超出了我的范围。所以我在加入后有一张桌子......
所以我需要那些存在 z 的 id-s,但之前不存在 x。
所以结果只有 3 因为 z 存在而 x 之前不存在。
sql - SQL 总行数 (DENSE_RANK/DISTINCT)
我正在选择可能包含重复的记录,我需要能够对不同的结果集进行分页。
目前,我有以下(简化的)查询:
此结果集中有 10 条记录,但DISTINCT
正确返回 3 条,并DENSE_RANK
正确标记它们1
、2
和3
我的问题paginationTotalRows
仍然是返回 10 个(包含原始重复项)结果集计数,如何修改查询以paginationTotalRows
返回正确的数量?
sql - 如何通过分组列进行排名/密集排名
以什么可能的方式/方法使用 sql 查询来获得这种结果。
评委对每位参赛者的评分进行排名,对决赛选手进行排序显示最终排名。
这个@Prince Jea 给出了一个解决方案,但它不是我所期待的实际结果,尽管它是正确的。尽管如此,我仍在寻找所需的输出。
SQL查询
结果
我更喜欢 SQL Fiddle 上的一些材料 http://www.sqlfiddle.com/#!6/30d03/2
sql - sybase ASE 中的 dense_rank 替代方案
有没有办法重建dense_rank
Sybase ASE 中的功能?
所以我需要每个元组(foo,bar)都有一个唯一的数字。
桌子:
结果:
没有这个功能我怎么能做到这一点dense_rank
?
非常感谢!
sql - SQL Server 密集排名以相反的顺序
我有 3 列,它们由 Dense Rank、Count 和 Row Number 创建
DR C RN
1 4 1
2 4 2
3 4 3
4 4 4
有什么方法可以让 DENSE_RANK 或其他排名函数以相反的顺序返回?
像这样
DR C RN
4 4 1
3 4 2
2 4 3
1 4 4
谢谢,
sql - 基于字段中的值的Sql排名组
我有一个表,其中一列的值将是这样的。
它将有一个“C”和一个或多个“H”记录。
我试图为每组“C”和一个或多个“H”提供一个组号。
由于担心性能,我不想使用游标。如何为“C”的每个子集和一个或多个“H”记录提供唯一的编号?
sql - How to Dense Rank Sets of data
I am trying to get a dense rank to group sets of data together. In my table I have ID, GRP_SET, SUB_SET, and INTERVAL which simply represents a date field. When records are inserted using an ID they get inserted as GRP_SETs of 3 rows shown as a SUB_SET. As you can see when inserts happen the interval can change slightly before it finishes inserting the set.
Here is some example data and the DRANK column represents what ranking I'm trying to get.
Example Data
Here is the query I Have that gets close but I seem to need something like a:
- Partition By: ID
- Order within partition by: ID, Interval
- Change Rank when: ID, GRP_SET (change)
sql - DENSE_RANK() OVER (Order by UniqueIdentifer) issue
I'm struggling trying to get DENSE_RANK to do what I want it to do.
It is basically to create a unique invoice number based on a unique identifier, but it needs to go up in order based on the date/time of the invoice.
For example I need:
But what I get when using DENSE_RANK OVER (Order by TxnId) is:
If I do DENSE_RANK OVER(TxnId,TxnDate), it is a complete mess and doesn't do what I want either.
Any ideas guys? Am I even using the write function to do this? Any help appreciated :)
sql-server-2008 - Visual Studio 2008 不支持 DENSE_RANK() OVER (ORDER BY ....)
我的 SQL 中有以下内容:
这在 SQL Server Management Studio 中运行良好,但不受 Microsoft Visual Studio 2008 支持。
我收到以下 SQL 语法错误:
不支持 OVER SQL 构造或语句
还有什么我可以使用的东西可以做同样的工作并且可以在 Visual Studio 2008 中工作吗?
非常感谢
sql - 使用 keep dense_rank 查找单个值
我的查询类似于:
我知道 rank 和 dense_rank 将在分区中返回“重复”值。就我而言,如果优先级在 2 个年龄段之间共享。
那么这条线会做什么:
它会为给定的名称、颜色选择优先级最低的行并返回相应的年龄吗?如果有两个具有相同优先级的行,它会随机选择其中一个行吗?