So I have this Table:
Trans_ID Name Fuzzy_Value Total_Item
100 I1 0.33333333 3
100 I2 0.33333333 3
100
Step 1:
CREATE TABLE ITEMSET
SELECT Name, SUM(Fuzzy_Value)/COUNT(*) Fuzzy_Value
FROM trans
GROUP BY ID
HAVING ROUND(SUM(Fuzzy_Value), 1) >= 0.1
Note the ROUND()
function - it's important, because you have values like .33333 that don't sum in a happy way.
Step 2:
ALTER TABLE ITEMSET ADD INDEX (Name)
SELECT a.Name Name1, b.Name Name2, SUM(Fuzzy_Value)/COUNT(*) Fuzzy_Value
FROM ITEMSET a JOIN ITEMSET b ON (a.Name != b.Name)
GROUP BY a.Name, b.Name
HAVING ROUND(SUM(Fuzzy_Value), 1) >= 0.1
Opps: I just noticed that you asked this half a year ago, so I guess there is no point in continuing. If you still need this answer leave a comment.