Andrew, What you're trying to do won't work. Read over the locking mechanism discussion in the documentation, then step through your program, keeping track of what locks are present when. You'll see that the exclusive lock the Delete needs is directly in conflict with the shared lock that the SELECT needs.
The best solution from a speed perspective is to build a list of the keys you need to delete. Once your select is finished, start a transaction, do all the deletes, and then commit the transaction. I'm not sure what your application model is that causes you to think you need to delete while the select is taking place, but the above solution is what users of every other SQL database are required to do. They wait until after their select has finished and then they do the delete. If you need the select and delete to be atomic, consider wrapping the whole thing in a transaction. If you're having trouble figuring out how to store the list of keys dynamically, drop me a line off list and I can provide you some examples. Clay Dowling -- Lazarus Notes from Lazarus Internet Development http://www.lazarusid.com/notes/ Articles, Reviews and Commentary on web development