简体   繁体   English

DENSE_RANK()" function 是否适用于 MySQL?

[英]is the DENSE_RANK()" function applicable in MySQL?

Does the following MySQL code or "DENSE_RANK()" function works in MySQL or is it only used in Oracle database???以下 MySQL 代码或“DENSE_RANK()”function 是否适用于 MySQL 或仅用于 Z30234141F???BFC41 数据库

Select Employee, Cost_Center, Cost_Grant, Percent
,DENSE_RANK() over (PARTITION BY Employee order by Percent ASC) as Rank
Employee员工 Cost_Center成本中心 Cost_Grant Cost_Grant Percent百分
AB61526 AB61526 10030 10030 54 54
AB61526 AB61526 14020 14020 46 46
AB60020 AB60020 1040 1040 68 68
AB60020 AB60020 10010 10010 32 32
AB60038 AB60038 11000 11000 71 71
AB60038 AB60038 10010 10010 29 29
AK50051 AK50051 10020 10020 23 23
AK50051 AK50051 11520 11520 78 78

Expected results output:预期结果 output:

Employee员工 Cost_Center成本中心 Cost_Grant Cost_Grant Percent百分 Rank
AB61526 AB61526 10030 10030 54 54 1 1
AB61526 AB61526 14020 14020 46 46 2 2
AB60020 AB60020 1040 1040 68 68 2 2
AB60020 AB60020 10010 10010 32 32 1 1
AB60038 AB60038 11000 11000 71 71 2 2
AB60038 AB60038 10010 10010 29 29 1 1
AK50051 AK50051 10020 10020 23 23 1 1
AK50051 AK50051 11520 11520 78 78 2 2

DENSE_RANK is supported in mysql beginning with version 8.0, and in MariaDB beginning with version 10.2.从 8.0 版开始的 mysql 和从 10.2 版开始的 MariaDB 支持 DENSE_RANK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM