Delete query

samotek

New member
Local time
Yesterday, 21:36
Joined
Aug 14, 2007
Messages
7
I want to make a delete query that deletes all the items that are in the minorty. For example, in the field “ Houses ” there are 10 rows with value 1 , 3 rows with value 3 and 4 rows with value 6. In this case I must delete all values except the value 1
I suppose the code should use Dcount, Max or something like that but I cannot do it. Any help ?”
 
Generally speaking I would try the following:

First step would be to query the table and count records for each value in the Houses field. Refine this by ordering the count field in descending order and limiting the results to the Top 1. Lets call this query qryMajority.

qryMajority
Houses
CountOfHouses


Then your delete query would delete all rows in the table where the value in the Houses field <> the value in Houses of qryMajority.
 

Users who are viewing this thread

Back
Top Bottom