SQL delete all rows except some ones

Viewed 35593

I have a table with the following columns (of urls):

 [id,url,visited,timestamp]
 Types:[int,string,int,long]

I want to:

Delete all urls except 10 unvisited priorizing higher timestamp (or delete all if all are visited for example)

Its posible to do that in a single query? Anyway whats the best query (queries) for doing it?

Thanks in advance

2 Answers
Related