Delete records not in top 15


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I'm creating a hall of fame page in my game and the page will only display the top 15 scores.
So I want to delete the scores that get bumped down the list.

How would I write the query to delete everything NOT in the top 15?

I've been trying different things, but nothing is working.
I thought maybe something like this, but it didn't work.
Line number On/Off | Expand/Contract $removeold = $db->execute("DELETE FROM `soundoff_hof` WHERE `id` NOT IN (SELECT `id` LIMIT 15 FROM `soundoff_hof`)");

am I close with something like this, or is there another method to do it?

No comments posted yet

Your Answer:

Login to answer
303 Like 25 Dislike
Previous forums Next forums
Other forums

Displaying data from MySql a different way
Hi all,
I'm pretty new to php and MySql and have hit a problem.

I am able to display data

check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.

The method delivers er_changed_data.

WM transfer order: confirm different batch than proposed by system
Hi folks,

following scenario: we have a full WM with mixed batch numbers allowed in stora

Firewall / visited websites logger
Hi. I have a firewall implementation and I want to log all the websites visited on the machine. S

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

Change image filetype on upload?
Hi,
I've got a form which uploads an image to the server.
Is it possible to change the image t

check comment for html
hi, I just wanted to check if a comment a user posts contains HTML, and if it does, to not allow it

SHOW TABLES Help
Hi all

I have the following

Code: [Select]<?php
$sql = "SHOW TABLES&quo

How to login with SAPCPIC userid
I have changed the Password for SAPCPIC in Development Server for 000,001 and 100 client.
But w

Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash