<legend id='2SnM7'><style id='2SnM7'><dir id='2SnM7'><q id='2SnM7'></q></dir></style></legend>

<small id='2SnM7'></small><noframes id='2SnM7'>

    <bdo id='2SnM7'></bdo><ul id='2SnM7'></ul>
  • <tfoot id='2SnM7'></tfoot>
  • <i id='2SnM7'><tr id='2SnM7'><dt id='2SnM7'><q id='2SnM7'><span id='2SnM7'><b id='2SnM7'><form id='2SnM7'><ins id='2SnM7'></ins><ul id='2SnM7'></ul><sub id='2SnM7'></sub></form><legend id='2SnM7'></legend><bdo id='2SnM7'><pre id='2SnM7'><center id='2SnM7'></center></pre></bdo></b><th id='2SnM7'></th></span></q></dt></tr></i><div id='2SnM7'><tfoot id='2SnM7'></tfoot><dl id='2SnM7'><fieldset id='2SnM7'></fieldset></dl></div>

      1. 如何检查mysql表中多列的重复项

        时间:2023-10-26

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

          • <small id='qf3IN'></small><noframes id='qf3IN'>

              <tbody id='qf3IN'></tbody>
              <i id='qf3IN'><tr id='qf3IN'><dt id='qf3IN'><q id='qf3IN'><span id='qf3IN'><b id='qf3IN'><form id='qf3IN'><ins id='qf3IN'></ins><ul id='qf3IN'></ul><sub id='qf3IN'></sub></form><legend id='qf3IN'></legend><bdo id='qf3IN'><pre id='qf3IN'><center id='qf3IN'></center></pre></bdo></b><th id='qf3IN'></th></span></q></dt></tr></i><div id='qf3IN'><tfoot id='qf3IN'></tfoot><dl id='qf3IN'><fieldset id='qf3IN'></fieldset></dl></div>

                <tfoot id='qf3IN'></tfoot>
                  <bdo id='qf3IN'></bdo><ul id='qf3IN'></ul>
                  本文介绍了如何检查mysql表中多列的重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一张棒球运动员表(全部 1000 名左右),有字段:

                  I have a table of baseball players(all 1000 or so), with fields:

                  mysql> describe person;
                  +-----------+-------------+------+-----+---------+----------------+
                  | Field     | Type        | Null | Key | Default | Extra          |
                  +-----------+-------------+------+-----+---------+----------------+
                  | id        | int(11)     | NO   | PRI | NULL    | auto_increment |
                  | firstname | varchar(30) | NO   |     | NULL    |                |
                  | lastname  | varchar(30) | NO   |     | NULL    |                |
                  +-----------+-------------+------+-----+---------+----------------+
                  

                  但我认为有些球员已经被加入了两次.我如何检查并检查特定名字、姓氏组合出现的次数?

                  But I think there are some players that have gotten added in twice. How can I go through and check for how many occurrences of a particular firstname, lastname combo?

                  推荐答案

                  这提供了重复的列表:

                  SELECT firstname, lastname, COUNT(*) 
                  FROM person 
                  GROUP BY firstname, lastname 
                  HAVING COUNT(*) > 1;
                  

                  如果您想查看每一行的计数,请删除 have 子句:

                  If you want to see the counts for every row remove the having clause:

                  SELECT firstname, lastname, COUNT(*) 
                  FROM person 
                  GROUP BY firstname, lastname;
                  

                  这篇关于如何检查mysql表中多列的重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:跨多个表的 MySQL 全文搜索 下一篇:SQL函数获取字符串在列中出现的次数?

                  相关文章

                • <small id='edsiM'></small><noframes id='edsiM'>

                  <tfoot id='edsiM'></tfoot>

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

                      <bdo id='edsiM'></bdo><ul id='edsiM'></ul>