A similar question was asked last week. There are some good answers there.
http://stackoverflow.com/questions/182544/sql-to-find-duplicate-entries-within-a-group
In that question, the OP was interested in all the columns (fields) in the table (file),
but rows belonged in the same group if they had the same key value (afield1).
There are three kinds of answers:
subqueries in the where clause, like some of the other answers in here.
an inner join between the table and the groups viewed as a table (my answer)
and analytic queries (something that's new to me).