deleting non-redundant records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to delete all records (from a table) which have a [part no] that does
not occur anywhere else (in the table). I'm still struggling with VBA Access
syntax and the object model, so I can't seem to make any progress. Any advice
would be much appreciated.
-- Al
 
Try SQL that looks like the following. Substitute your table name and field
name

DELETE DistinctRow YourTable.*
FROM [YourTable]
WHERE YourTable.[Part No] In
(SELECT [Part No]
FROM [YourTable]
GROUP BY [Part No]
HAVING Count[Part no] = 1)

BACKUP your data first. If this doesn't do what you want, you won't be able
to recover the deleted records
 
Back
Top