Yeah, it's a bit hard to explain exactly... if you want to try it out, you can access the prototype here: http://www.headgutcheck.com/head-gut-check-session - it does require registering on the site so that data can be added to the full research set - but if you let me know you're trying it out just to see what it is, I can delete your records afterwards.
Anyway, what's happening is the user views pairs of images, 10 pairs per topic, 1 pair presented at a time - and chooses one image or the other (left or right). The image pairs are the same for each topic, presented in the same order. The first three topics are changeable (by the user), the last two topics are static. (The prototype above is 4 changeable, 1 static)
The 10 pairs of images are actually 5 images shown in every possible pairing (each image shown 4 times, so it gets paired with each other image once/topic).
What I want to know is:
How many times was each image chosen for Topic 1?
How many times was each image chosen for Topic 2?
and so on...
So, for this question, getting the "count" of "A"s and "B"s etc. works perfectly -- and the value for each image is always between 0 and 4, and the total count of all images for a topic always adds to 10.
I also want to know:
How many times did you choose the same way for Topic 1 and Topic 2?
How many times did you choose the same way for Topic 2 and Topic 3?
Now, that second one is NOT did you choose Image A the same number of times for Topic 1 and Topic 2 (because of the way the pairings work, you could choose "A" twice for both topics, but at different choice points or questions )-- it's on a choice point by choice point basis... so it's actually:
Was your choice on the first pairing the same on Topic 1 and Topic 2?
Was your choice on the second pairing the same on Topic 1 and Topic 2?
... then total the number of times the choice was the same.
So for this question, I have to go through question by question for two topics, comparing values and adding a count of 1 for each same answer -- so the value will be between 0 and 10.
I'll test the code you suggested to see if it produces the desired output... if it does, great!! if not, I'm sure it will provide me with clues to help me either figure it out or to explain it better.
I've also started a new topic under the databases forum to ask about the database issue - rather than detail my thinking again here, here's a link:
viewtopic.php?f=2&t=79111
Thanks!!