You can tell if someone has had COVID-19 if they have antibodies to it in their blood. You can also tell if someone has had other coronaviruses if they have antibodies specific to the other viruses. Then you compare the outcomes for enough people that had only one or both viruses.
Yes, but my point is that there are a vast number of coronaviruses -- that is, members of the family
Orthocoronavirinae -- and all of us must have, at various times in our lives, encountered, and developed immunity against, literally thousands of different ones, depending on our age and where we have lived and visited.
You said,
That's why it has been reported that people with prior infection by other coronaviruses (which includes the common cold) do better against COVID if they get it - their system has already been primed to react to similar infections.
Since just about everyone in the world must have suffered from multiple colds from childhood onwards, that doesn't seem to me likely to tell us much about immunity from COVID, since almost everyone will have developed whatever immunity this gives, so that's simply helped establish the general base immunity.
How, though, do you determine which of the (say) 1000-odd somewhat less common
Orthocoronavirinae that against which A has developed immunity, and B has not, gives A some immunity against Covid-19 which B lacks?
And how, without also doing a complete genetic analysis of A and B, do you determine the role played by genetics in developing any particular immunity in response to an infection by a similar virus, which I know British scientists are looking at?
You've got so many different variables to compare, to my mind, that, unless you've first developed an hypothesis that prior infection to virus XYZ helps develop immunity against COVID, so unless you know what to look for when examining the samples taken from immune and non-immune subjects, you''re never going to find what you're looking for -- you can't simply ask "what's the difference between A's and B's medical history?" because they're going to be too different to make any useful comparisons without more information.