Thread: Deleting rows

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Deleting rows


    Hi!

    Is it possible to delete all rows below the ten rows with highest value in a field?

    I have a hightscore with ten rows and I don't want to have more than ten rows. So each time someone inserts a highscore, the top ten scores must be found and the one with the lowest value deleted.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    that sounds like a strange approach.

    Just collect all results and calculate the top 10 on the fly:
    Code:
    ... ORDER BY result DESC LIMIT 10
    Then there's no need to fumble with the existing rows every time there's a new entry.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0
    If I do that and don't erase any rows, the table will eventuelly get very large. I want to prevent that.

IMN logo majestic logo threadwatch logo seochat tools logo