need help with find similar records

hi,

i have a model like this capturing integer values.

testrun_id
valve_a

valve_b

valve_c

valve_…n

what i would like to know is how to write an ar-query to find similar records across all valve-values. similar to levenshtein distance, but for integers. i could imagine also grouping some valves-values into a total and compare the totals, but not sure.

any ideas?

thx