“Temukan nilai paling sering di kolom SQL” Kode Jawaban

Temukan nilai paling sering di kolom SQL

SELECT       `column`,
             COUNT(`column`) AS `value_occurrence` 
    FROM     `my_table`
    GROUP BY `column`
    ORDER BY `value_occurrence` DESC
    LIMIT    1;
Wild Warbler

SQL Pilih nilai paling sering di kolom

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

Jawaban yang mirip dengan “Temukan nilai paling sering di kolom SQL”

Pertanyaan yang mirip dengan “Temukan nilai paling sering di kolom SQL”

Lebih banyak jawaban terkait untuk “Temukan nilai paling sering di kolom SQL” di Sql

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya