I regularly have this problem because the local administrators of an ActiveDirectory authenticated Moodle site import courses - with user data! - from their previous site which was Office365. Those users end up being manual accounts in the current Moodle with identical data as the LDAP account. Pretty confusing.
The key to understand the cause is the column 'id' of the 'user' table. The 'id' is unique. Moodle doesn't have "duplicates", they are just different accounts!
Authentication
Issue on multiple user accounts for one person
This discussion has been locked so you can no longer reply to it.