I have the following SQL statement which seems to be deleting every row in the selected table. What it should be doing is deleting all but the top 10 where the difficulty level equals one.
DELETE FROM Scores
WHERE Highscore_ID
NOT IN (SELECT TOP 10 highScore FROM Scores WHERE difficulty = 1 ORDER BY HighScore DESC)
Any suggestions as to why this would be deleting all rows? When running the subquery, it selects the proper rows, however, when deleting, it seems to want to delete every row.
You compare Hichscore_Id with a column highScore. Does those columns really have the same values?
Then it should be
EDIT:
Try this