I'm trying to create a query in c# for Windows Mobile 7 using linq that will delete all but the top 10 highscores in a table. The table, Scores, is simple, and contains highScore_ID (int), highScore (int), and playerName (string).
SQL:
DELETE FROM Scores
WHERE highscore_ID NOT IN (SELECT TOP 10 highScore FROM HighScore)
LINQ:
from c in context.Scores where !((from o in context.Scores select
o.highScore).Take(10)).Contains(c.highscore_ID) select c;
I seem to be getting errors with this linq query, any suggestions would be very much appreciated.