<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表中多列的重复项

        How to check for duplicates in mysql table over multiple columns(如何检查mysql表中多列的重复项)

          <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表中多列的重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)(超出最大存储过程、函数、触发器或视图嵌套级别(限制 32))
                  How to View Oracle Stored Procedure using SQLPlus?(如何使用 SQLPlus 查看 Oracle 存储过程?)
                  How to debug stored procedure in VS 2015?(如何在 VS 2015 中调试存储过程?)
                  Set the variable result, from query(设置变量结果,来自查询)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)

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

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

                    <tbody id='edsiM'></tbody>

                    • <legend id='edsiM'><style id='edsiM'><dir id='edsiM'><q id='edsiM'></q></dir></style></legend>
                    • <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>