General discussion
May 16, 2006 at 01:34 AM
chzumbrunnen

recursively looping over a table to find most similar profiles (matching an

by chzumbrunnen . Updated 20 years, 3 months ago

I have a simple MSSQL 2000 table with only 3 columns:

question_user_userID int 4
question_user_questionID int 4
question_user_questionanswer int 4

userID and questionID together build the primary key

Now I’d like to find all answers of a certain user and find the other users with the most matching answers e.g:

for user 1 I have

1,1,0
1,2,1
1,3,0
1,4,5 meaning question 1 and 3 are answerd with 0, which means no, question two is 1 (yes) and question 4 is 5, which means ‘don’t know’

Now I’d like to recursively loop through the table and count matching answers for each other user and give back the top n rows.

Can you help me with this?

now I’d like to find

This discussion is locked

All Comments