token_remedie
Registered User.
- Local time
- Tomorrow, 05:56
- Joined
- Jul 7, 2011
- Messages
- 78
Hey, need a little help here, I have a query that finds duplicates and returns a single value in an attempt to identify duplicates in a table.
Now I'm trying to delete those duplicate entries by deleting from another query and it's not working, I'm getting a range of errors from ' cannot delete from the specified table' to just nothing happening, depending on what i play around with. Any ideas?
thanks
Code:
SELECT DISTINCT Books.[Asset Number], Books.[Serial No], Books.CoCd, Books.Class, Books.[Asset Description], Books.[Invent No], Books.CostCentre, Books.Plnt, Books.Location, Books.[Location Code], Books.[Location Name], Books.FundTyp, Books.ProgSrc, Books.SubClass, Books.Vendor, Books.Manufacturer, Books.Cost, Books.[W Start], Books.Field1, Books.R2, Books.Formula, Books.deployment
FROM Books
WHERE (((Books.[Asset Number]) In (SELECT [Asset Number] FROM [Books] As Tmp GROUP BY [Asset Number],[Serial No] HAVING Count(*)>1 And [Serial No] = [Books].[Serial No])))
ORDER BY Books.[Asset Number], Books.[Serial No];
Now I'm trying to delete those duplicate entries by deleting from another query and it's not working, I'm getting a range of errors from ' cannot delete from the specified table' to just nothing happening, depending on what i play around with. Any ideas?
thanks

Code:
DELETE books.*
FROM books, Find_duplicates_for_Books where exists (select * from find_duplicates_for_books);