I am trying to something like below and hope some guru can advise how to accomplish this :
In my db, I have a column with all random numbers : e.g : 3213, 1234, 1235, 3132, 8231 and etc, with more than 300 records
Now I want to do something like match all the numbers like 3213 and permuted numbers of 3213 with all other numbers and count +1 if the other numbers matched other rows in the table.
I have these rows in the table :
I am thinking to do something like this to get what I want : We take 1)3231 as an example :
First, I will get all permuted numbers for the 1) 3231
then assign each of the number into an array
from the array, I will do another round of matching with all other records from other rows for each number stored in the array.
e.g : take *3231 to match with other rows in the table
if not found, then count is 0
then move on to the second permuted number *3213 to match with other records
Same goes to the others.
After all the permuted number for 1) 3231 have been matched with other rows, we will move on to the other row number - 2) 3211 and do the same process all over again... get all permuted numbers for 3211, assign to array and do matching with all other rows.
I am wondering is there any more simple way to accomplish this function?
Hope gurus can get what I am trying to do and share with me your ideas. Thanks