The original question are based on my previous question here
But as i have found there is an K-Means algorithm application for PostgreSQL, i decided to rather weighing the score to count the number of occurance of each value in the array
so if the previous result look like this
ids|uid|pattern|score|
---|---|-------|-----|
1| 1|[1,1,2]| 280|
2| 2|[2] | 80|
the result must be count of each pattern but i want to keep the score empty since the score are the result from the K-Means alghorithm
ids|uid|pattern|b1|b2|b3|b4|b5|b6|b7|score|
---|---|-------|--|--|--|--|--|--|--|-----|
1| 1|[1,1,2]| 2| 1| 0| 0| 0| 0| 0| |
2| 2|[2] | 0| 1| 0| 0| 0| 0| 0| |