📌  相关文章
📜  tsql 查找列中出现次数最多的项目的值和计数 - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:33.554000             🧑  作者: Mango

代码示例1
select item, cnt
from (
  select
      item
      ,cnt = count(*)
      ,seqnum = row_number() over (partition by id order by count(*) DESC)
  from 
      src_table
  group by
      item
) sub_qry

where seqnum = 1;