Hi Robin
The angle-brackets are part of the space-holder in the example, so they should not be used in the actual SQL statement. Either leave them out completely or, if your table name contains non-alphanumeric characters, use square brackets:
DELETE students.* FROM students
WHERE FieldD IN(SELECT MIN(FieldID) FROM students Group By [fieldid] Having Count(fieldID) > 1)
Best wishes,
Graham
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Monday, 20 October 2014 11:52
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Removing Duplicate entries
I have a table with a few duplicate entries.
The Microsoft forum page says:
""" Make sure that your table has an autonumber field and it is set as the primary key. I'll call it TempID. """
My table has 'FieldID' as an autonumber field and is the primary key.
The page says:
DELETE <yourtable>.* FROM <yourtable> WHERE TempID IN(SELECT MIN(TempID) AS MinOfTempID FROM <yourtable> Group By [Name] Having Count(TempID) > 1)
I have edited to this:
DELETE <students>.* FROM <students> WHERE FieldD IN(SELECT MIN(FieldID) AS MinOfFieldID FROM <students> Group By [fieldid] Having Count(fieldID) > 1)
and I still get an error. (The marker appears at the second <students> above.)
What Have I missed?
Many thanks,
Robin Chapple
Posted by: "Graham Mandeno" <graham@mandeno.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar