Thanks, Pat. That's basically what I was looking for.
I can't seem to find any info. on the query I'm trying...
This is in Access and what I want to do is go through my tables and only keep five records.
Code:
DELETE * FROM Table1 WHERE ... NOT IN
(SELECT TOP 5 * FROM Table1)
I realize that's wrong and the only way I can get it to work is to specify key fields from the table:
Code:
DELETE * FROM Table1 WHERE key_field NOT IN
(SELECT TOP 5 key_field FROM Table1
ORDER BY key_field)
The problem with that is the key_field is different for every table and I have about 500 tables I need to do this for. I need a more generic way to delete the records so I can reuse the query.