sql select most frequent value in column

Solutions on MaxInterview for sql select most frequent value in column by the best coders in the world

showing results for - "sql select most frequent value in column"
Ashley
01 Jun 2018
1SELECT col, COUNT(col) AS value_occurrence
2FROM m_table GROUP BY col ORDER BY value_occurrence DESC LIMIT 1;
3
4-- Oracle <= 11g
5SELECT * FROM (SELECT col, COUNT(col) AS value_occurrence
6FROM m_table GROUP BY col ORDER BY value_occurrence DESC)
7WHERE rownum = 1;