Answers for "how to find which row has the most counts sql"

SQL
0

tsql find the value and count of the item that occurs the most in a column

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;
Posted by: Guest on February-20-2021

Code answers related to "how to find which row has the most counts sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language