SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Froot r gewd SubKamran's Avatar
    Join Date
    May 2002
    Location
    North Star State
    Posts
    597
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Delete repeat values

    How can I delete records with the same value for one field?

    Like so:

    Code:
    DELETE FROM sessions WHERE session_user_ip = session_user_ip"
    Or some such thing. Do I need to create a loop in my code, or can this be done using a query?

    I'm using MySQL 3.23
    "Sometimes little is more."
    Kamran A
    Web Dev/Designer
    Keyboard not found: Please Press F1 to Continue

  2. #2
    SitePoint Evangelist compwizard's Avatar
    Join Date
    May 2002
    Location
    United States
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In general..it is best to check for dups. before inserting, but let me work on the sql code
    Compwizard
    "There are 10 kinds of people in this world -- those who know binary, and those who don't."

  3. #3
    SitePoint Evangelist compwizard's Avatar
    Join Date
    May 2002
    Location
    United States
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a great article which should explain everything:
    http://www.databasejournal.com/featu...0897_2201621_1
    Compwizard
    "There are 10 kinds of people in this world -- those who know binary, and those who don't."


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
  •