I have been wracking my brains trying to solve this problem but I have come to the conclusion that it possibly cannot be done in SQL. I have a table which has three fields:
AutoID INTEGER
MID varchar(50)
CategoryID INTEGER
Example Data Could be
1,DD45, 1
2,DD45, 3
3,DD45, 6
4,DD45, 8
5,RT56, 3
6,RT56, 8
7,UJ78, 1
MID is effectively a userid and CategoryID contains a id of a category to which the user has subscribed. The problem is that i am trying to write a SELECT statement which when given a MID will return a list of records of all other users in the table and the percentage(or number) of categories the users have in common with given MID. So for the example data above if MID DD45 was given the following records would be returned.
RT56, 50%
UJ78, 25%
Any ideas?
AutoID INTEGER
MID varchar(50)
CategoryID INTEGER
Example Data Could be
1,DD45, 1
2,DD45, 3
3,DD45, 6
4,DD45, 8
5,RT56, 3
6,RT56, 8
7,UJ78, 1
MID is effectively a userid and CategoryID contains a id of a category to which the user has subscribed. The problem is that i am trying to write a SELECT statement which when given a MID will return a list of records of all other users in the table and the percentage(or number) of categories the users have in common with given MID. So for the example data above if MID DD45 was given the following records would be returned.
RT56, 50%
UJ78, 25%
Any ideas?