Select them both and there should be a Merge Composition button top right. It may not work in search results, in this case go to My Tracks or My Compositions
There are some preconditions:
- Both tracks must be in your library
- Both tracks must have composers (might not be strictly required but it helps)
- Both tracks must be recognized as a composition. Check the three-dot menu of the track. It needs to have a Go to Composition entry.
"Show library counts for recordings" not finding all versions of a song - #2 by Suedkiez
If a track is not recognized as a composition, there may be workarounds to make it one, but they don’t always work. It’s a bit of a mystery what makes a track a composition, but most likely the property must come from a metadata provider and it’s not possible to add it locally: