Answers for "Hhow to count which values appear the most in a row 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 "Hhow to count which values appear the most in a row sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language