SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    You wanna' peice o' me! Automated's Avatar
    Join Date
    Nov 2001
    Location
    UK
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Removing Duplicate

    Hi,

    I am very new to mysql, and woud like to know if there is a simple query that i could through at a table that would remove all duplicate records.

    Is there?

    Thanks
    Matthew Taylor
    FreelanceForums.com - Do you Freelance ?
    Visit the Freelance Forums and participate in all areas of Freelance Chat

  2. #2
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you explain "duplicate" more with an example of what you have and what you want to end up with?
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You know, Google is pretty good.

    Google: sql remove duplicate record

    No doubt you'll need to jump through some hoops with MySql, but that's the price you have to pay for using it.

    This is a bit crude for my liking but might do the trick.

  4. #4
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, i'm not exactly sure what he wnats to change, that's why i asked to elaborate. if you had full rows with the same values, you could remove the dupes like this

    Code:
    CREATE TEMPORARY TABLE temp SELECT DISTINCT * FROM table;
    TRUNCATE TABLE table;
    INSERT INTO table SELECT * FROM temp;
    DROP TABLE temp;

  5. #5
    You wanna' peice o' me! Automated's Avatar
    Join Date
    Nov 2001
    Location
    UK
    Posts
    338
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that guys, its perfect!

    Matthew Taylor
    FreelanceForums.com - Do you Freelance ?
    Visit the Freelance Forums and participate in all areas of Freelance Chat


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •