I have a ms access mdb-file like this:
table Main:
int recordID
int status
int placement
bool @private
string category
string note
string description
string dueDate
bool completed
int priority
byte[] blob
bool repeatOnCompleteDate
string completeDate
bool alarmSet
string alarmTime
int alarmAdvance
string repeatStartDate
string repeatInfo
I would like to remove duplicate entries where description+note is the same so only one entry with the same description+note content remains. If there are two or more duplicates where some entries’ category is 0(beware it’s a string) remove this rather than the one whose category does not equal zero.
Fi.
Desc - Note - Cat
Hello - Test - 0
Hello - no - 3
Hello - Test - 0
Hello - Test - 4
Hello - Test - 0
Then one single Desc Hello with Note Test and with Category 4 should remain.
I found
delete from MyTable
where uniqueField not in
(select min(uniqueField) from MyTable T2
where T2.dupField=MyTable.dupField)
converted it to
delete from Main where Category not in (select min(Category) from Main T2 where T2.Description=Main.Description)
but that does not work.
Which MSACCESS SQL Command do you recommend?
There are number of sources available on net you may see here or here. You can also do this through query like