View Full Version : Can a delete query delete only ONE record?


mrmazahei
05-27-2002, 03:05 PM
Hello all,

Thank you very much in taking interst to answer my question.

It seems to me like a simple solution but no matter what I did I could
not solve it. Heres my problem...

Lets say you have a simple table of 100 records, 10 of those records
contain a field with the letters "ZZZ".

Ok now I make a delete query which selects any record with the letters
"ZZZ"
obviously the query selects ten records,

Ok now I want to run the query BUT I want it to delete only one of
those records NOT all ten records. how do I do that?

Thank You again for your kind help.

Sincerely Yours.

Reza Mazaheri.

llkhoutx
05-27-2002, 03:40 PM
How do you know which one to delete? Develop a delete query with that criteria.

mrmazahei
05-28-2002, 04:44 AM
Thank you for replying,

Actually all the 10 records are the same so it dose not matter which one it deletes just as long as it ONLY deletes ONE record every time the query is run.

Thanks again.
Reza

mrmazahei
05-28-2002, 05:44 AM
Thanks so much guys,

Delete querys do not except topvalues, so I cant try that.

I put the "zzz" in the criteria box under the WHERE, then it returns all ten records, but now how do I delete only one of them (anyone of them)

I even put an autonumber field in the table, but when I used the DMAX in the criteria, it retunes the last autonumber of the entire table, not just the "zzz"

Thanks again.
Reza.

Fizzio
05-28-2002, 07:04 AM
Set up a Select Query with the required criteria and set the top values to one. Then Run the Delete Query on this query.

HTH

David R
05-28-2002, 07:05 AM
The logic of what you are doing escapes me.

Why do you have 10 records of the exact same thing, and why do you need to delete one and only one when a query is run?

Can you give a more concrete example? Perhaps there is an alternate structure someone can suggest.