<bdo id='kUtWa'></bdo><ul id='kUtWa'></ul>
  1. <small id='kUtWa'></small><noframes id='kUtWa'>

    <legend id='kUtWa'><style id='kUtWa'><dir id='kUtWa'><q id='kUtWa'></q></dir></style></legend>

      <i id='kUtWa'><tr id='kUtWa'><dt id='kUtWa'><q id='kUtWa'><span id='kUtWa'><b id='kUtWa'><form id='kUtWa'><ins id='kUtWa'></ins><ul id='kUtWa'></ul><sub id='kUtWa'></sub></form><legend id='kUtWa'></legend><bdo id='kUtWa'><pre id='kUtWa'><center id='kUtWa'></center></pre></bdo></b><th id='kUtWa'></th></span></q></dt></tr></i><div id='kUtWa'><tfoot id='kUtWa'></tfoot><dl id='kUtWa'><fieldset id='kUtWa'></fieldset></dl></div>
      <tfoot id='kUtWa'></tfoot>
    1. 从 MySQL 的字段中选择最常见的值

      Select most common value from a field in MySQL(从 MySQL 的字段中选择最常见的值)
        <tfoot id='XRM4W'></tfoot>
        <i id='XRM4W'><tr id='XRM4W'><dt id='XRM4W'><q id='XRM4W'><span id='XRM4W'><b id='XRM4W'><form id='XRM4W'><ins id='XRM4W'></ins><ul id='XRM4W'></ul><sub id='XRM4W'></sub></form><legend id='XRM4W'></legend><bdo id='XRM4W'><pre id='XRM4W'><center id='XRM4W'></center></pre></bdo></b><th id='XRM4W'></th></span></q></dt></tr></i><div id='XRM4W'><tfoot id='XRM4W'></tfoot><dl id='XRM4W'><fieldset id='XRM4W'></fieldset></dl></div>
      • <legend id='XRM4W'><style id='XRM4W'><dir id='XRM4W'><q id='XRM4W'></q></dir></style></legend>

        <small id='XRM4W'></small><noframes id='XRM4W'>

        • <bdo id='XRM4W'></bdo><ul id='XRM4W'></ul>

                  <tbody id='XRM4W'></tbody>
                本文介绍了从 MySQL 的字段中选择最常见的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我有一个有一百万行的表格,我如何从一个字段中选择最常见(在表格中出现最多的值)的值?

                I have a table with a million rows, how do i select the most common(the value which appears most in the table) value from a field?

                推荐答案

                您需要按感兴趣的列进行分组,并为每个值选择值本身及其出现的行数.

                You need to group by the interesting column and for each value, select the value itself and the number of rows in which it appears.

                然后是排序问题(将最常见的值放在首位)并将结果限制为仅一行.

                Then it's a matter of sorting (to put the most common value first) and limiting the results to only one row.

                在查询表单中:

                SELECT column, COUNT(*) AS magnitude 
                FROM table 
                GROUP BY column 
                ORDER BY magnitude DESC
                LIMIT 1
                

                这篇关于从 MySQL 的字段中选择最常见的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Can#39;t Create Entity Data Model - using MySql and EF6(无法创建实体数据模型 - 使用 MySql 和 EF6)
                MySQL select with CONCAT condition(MySQL选择与CONCAT条件)
                Capitalize first letter of each word, in existing table(将现有表格中每个单词的首字母大写)
                How to retrieve SQL result column value using column name in Python?(如何在 Python 中使用列名检索 SQL 结果列值?)
                Update row with data from another row in the same table(使用同一表中另一行的数据更新行)
                Exporting results of a Mysql query to excel?(将 Mysql 查询的结果导出到 excel?)
                  <tbody id='NHax4'></tbody>

                  1. <tfoot id='NHax4'></tfoot>
                      <i id='NHax4'><tr id='NHax4'><dt id='NHax4'><q id='NHax4'><span id='NHax4'><b id='NHax4'><form id='NHax4'><ins id='NHax4'></ins><ul id='NHax4'></ul><sub id='NHax4'></sub></form><legend id='NHax4'></legend><bdo id='NHax4'><pre id='NHax4'><center id='NHax4'></center></pre></bdo></b><th id='NHax4'></th></span></q></dt></tr></i><div id='NHax4'><tfoot id='NHax4'></tfoot><dl id='NHax4'><fieldset id='NHax4'></fieldset></dl></div>
                      • <legend id='NHax4'><style id='NHax4'><dir id='NHax4'><q id='NHax4'></q></dir></style></legend>
                          <bdo id='NHax4'></bdo><ul id='NHax4'></ul>

                          <small id='NHax4'></small><noframes id='NHax4'>