Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql select most frequent value in column

SELECT col, COUNT(col) AS value_occurrence
FROM m_table GROUP BY col ORDER BY value_occurrence DESC LIMIT 1;

-- Oracle <= 11g
SELECT * FROM (SELECT col, COUNT(col) AS value_occurrence
FROM m_table GROUP BY col ORDER BY value_occurrence DESC)
WHERE rownum = 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql current time 
Sql :: mysql failed to login as root@localhost 
Sql :: does insert into overwrite sql 
Sql :: sql insert multiple rows 
Sql :: joomla execute raw sql 
Sql :: oracle running queries 
Sql :: sql table 
Sql :: how to select unique element in sql 
Sql :: remove space in sql server 2012 
Sql :: restore database postgresql 
Sql :: copy value from one column to another postgres 
Sql :: what is default mysql database password in linux 
Sql :: select 2 rows in sql 
Sql :: how to enable extension in postgreSQL 
Sql :: index column size too large. the maximum column size is 767 bytes. mysql 
Sql :: sql update statement 
Sql :: json extract 
Sql :: how to lock table in mysql 
Sql :: postgresql subtract date/hours 
Sql :: MySQL INSERT IGNORE Statement 
Sql :: for json path sql server 
Sql :: MYSQLI_ASYNC 
Sql :: SQL Modify Column in a Table -PostgreSQL 
Sql :: SQL Less Than or Equal to Operator 
Sql :: sql currency format 
Sql :: mysql drop key 
Sql :: sql find table by name 
Sql :: postgres dump sql insert 
Sql :: sql server list database 
Sql :: postgre insert select 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =