Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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;
Comment

PREVIOUS NEXT
Code Example
Sql :: android sqlite query con join 
Sql :: learn sqlite dart 
Sql :: mysql configuration file storage location 
Sql :: sql grant select only 
Sql :: Shell Comands 
Sql :: mysql count with two joins 
Sql :: To access SQL database file 
Sql :: sql server run procedure on all databases 
Sql :: sql bild in function 
Sql :: power bi connect to postgresql 
Sql :: oracle query to find schema you are working on 
Sql :: copy table structure from postgresql to mysql 
Sql :: update values in select statement sql 
Sql :: the primary key is selected from the 
Sql :: unable to install sql server (setup.exe) exit code (decimal) 
Sql :: nosql databases 
Sql :: how to switch user in mysql 
Sql :: SQL LIKE With Wildcards 
Sql :: django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.8.0. 
Sql :: sql script to delete duplicate records in a table 
Sql :: minus vs except in sql 
Sql :: sqlalchemy one column of two has to be not null 
Csharp :: count number of enum values C# 
Csharp :: unity quit in edtor 
Csharp :: quit button unity 
Csharp :: asp.net c# write string to text file 
Csharp :: c# check file exists 
Csharp :: degree to radians c# 
Csharp :: random bool c# 
Csharp :: dotnet executable directory 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =