Comparing groups - z-scores

I have two groups A and B. Each subject has provided scores on a number of tests, and I want to give each subject an overall score based on these sub-tests and then compare performance between the groups. I understand the best way of calculating a cumulative score is to work out each subject's z-score on each test, then caluculate an average overall z-score for each subject, from which I can calculate an overall group average z-score for each group and compare these.

My main question, when calculating the z-scores, do I use the GROUP mean and the GROUP standard deviation, or the mean and SD of both groups combined.

So for example, for a subject from Group A, is his z-score

z = (x - GROUP A mean)/Group A SD
or is it z = (x - OVERALL Mean)/Overall SD


excuse me if your intent is compering two groups
to know, there is several statistical software and its not necessary that you compare them yourself.
but if i have understood true , A is results of a test but B is results of another test on some of individuals.
is it true?
if it is true then the first answer is true for obtaining z-score?
Best regards
Hey, thanks for the reply :)

No, A and B referred to my two groups which I am comparing: Group A and Group B. Both groups take the same test, and I am comparing performance of the two groups on the tests.

However, I wanted to transform the raw scores of both groups on all the tests to z-scores. So my question was, when calculating the z-scores, do you use the Group mean (i.e. Group A mean and SD for working out Group A z-scores, Group B mean and SD for working out Group B z-scores) or do you use the overall mean and SD for all subjects?

Sorry if you don't understand me, but thanks anyway!