List:General Discussion« Previous MessageNext Message »
From:Andy Harrison Date:March 22 1999 7:47pm
Subject:Re: Primary Key trouble
View as plain text  
Christian Mack wrote:

> Hi Andy
>
> We need the charset you use with mysql, because the sorting order depends on that.
> If you want to find the "duplicate" yourself, you can use:
> SELECT
>         t1.Name
> FROM
>         table AS t1
>         , table AS t2
> WHERE
>         t1.Name like t2.Name
> GROUP BY
>         t1.Name
> HAVING
>         COUNT(*) > 1
>
> Hope this helps
> Christian
>
> ---------------------------------------------------------------------
> To request this thread, e-mail mysql-thread767@stripped
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
> For archive commands, etc, e-mail: mysql-help@stripped

Thanx for that.  I knew there had to be an sql way of doing it.  I ended up doing the
VERY long way.  I took a dump of the database, chopped out everything except the
INSERT commands and ran the following:

mysqldump database table > allscript
---=> chop chop goes the vi ninja
cat allscript | cut -c 24-999 | cut -f 2 -d \' | sort > dupe1
cat allscript | cut -c 24-999 | cut -f 2 -d \' | sort | uniq > dupe2
diff dupe1 dupe2

...and viola.  It turns out it was a stupid apostrophe problem, so I nixed that and
it went ok.


--

          .==,_
         .===,_`\                                Andy Harrison
       .====,_ ` \      .====,__
 ---     .==-,`~. \           `:`.__,     __
  ---      `~~=-.  \           /^^^      / /    __  _  _  _  _ __  __
    ---       `~~=. \         /         / /__  / / / \// //_// \ \/ /
                 `~. \       /         /____/ /_/ /_/\/ /___/  /_/\_\
                   ~. \____./           ...for IQs GREATER than 98...
                     `.=====
                  ___.--~~~--.__
        ___\.--~~~              ~~~---.._|/  (remove the obvious
        ~~~"                             /    to e-mail me...)



Thread
Primary Key troubleAndy Harrison21 Mar
  • Primary Key troublesinisa21 Mar
  • Re: Primary Key troubleChristian Mack22 Mar
  • Re: Primary Key troubleAndy Harrison22 Mar