Assuming 'id' is an identifying column and 'dupe_col' is the column with
duplicate values...

    SELECT id, COUNT( dupe_col ) AS cnt
    FROM tbl
    GROUP BY dupe_col
    HAVING cnt > 1

HTH

PB

-----
  ----- Original Message -----
  From: Randy Chrismon
  To: [EMAIL PROTECTED]
  Sent: Tuesday, October 21, 2003 12:14 PM
  Subject: Find non-unique values



  I have a table wherein one column is SUPPOSED to be unique but I
  strongly suspect isn't. Because I had this suspicion, I did not apply
  a unique index to the column. Assuming there are no null values in
  that column how would I find the instances of non-unique values? If I
  try to alter table add unique... will it abort if the values are
  non-unique, or will it drop the non-unique rows? (MyISAM tables).
  There is a valid primary key on the table but (obviously) it does not
  include the column in question.
  Also, as this is really a SQL question (I think), is there a good
  mailing list, forum, or web site devoted to SQL questions --
  particularly the dialect of SQL spoken by MySQL?
  Thanks.
  Randy

  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to