Merging two separate member databases into a single SSO database

let’s say i have two independent Discourse sites that i want to use the same member database for logins; as in, one site would be the SSO provider for logins, but everything else such as posts, PMs, likes, etc. would be separated per site.

how can i combine the initially separated member databases so that one of the sites can serve as the SSO provider for the other? what happens if there are two users with the same username or email address?