It's not clear what you want done: you do not define similarity.

FWIW, the provided data can be grouped using only column k, by a simple floor( k / 100.0 ) * 100 expression. How can more be deduced from your data?

select mm, m , p , k , y , my, r , s , o , c, whatness from t order by floor( k / 100.0 ) * 100 , k ; mm | m | p | k | y | my | r | s | o | c | what +ness ----+-----+-------+--------+----+----+--------+----+--------+---+----- +------ 84 | 250 | 16700 | 4900 | 13 | 0 | 102124 | 23 | 0 | 0 | * si +milar 84 | 250 | 16700 | 4900 | 13 | 6 | 102124 | 3 | 0 | 5 | * si +milar 84 | 250 | 17290 | 4905 | 13 | 6 | 102124 | 1 | 3687 | 0 | * si +milar 84 | 250 | 17290 | 4905 | 13 | 6 | 102124 | 22 | 3687 | 2 | * si +milar 84 | 250 | 17290 | 4905 | 13 | 6 | 102124 | 4 | 3687 | 2 | * si +milar 84 | 250 | 17290 | 4910 | 13 | 6 | 102124 | 3 | 3687 | 2 | * si +milar 84 | 250 | 10900 | 46423 | 11 | 5 | 52012 | 3 | 485 | 1 | # si +milar 84 | 250 | 10200 | 46423 | 11 | 5 | 52012 | 23 | 485 | 1 | # si +milar 84 | 250 | 10900 | 46423 | 11 | 5 | 52012 | 8 | 485 | 0 | # si +milar 84 | 250 | 9900 | 46423 | 11 | 5 | 52012 | 22 | 485 | 1 | # si +milar 84 | 250 | 14380 | 49501 | 11 | 5 | 0 | 1 | 140427 | 0 | § si +milar 84 | 250 | 13980 | 49501 | 11 | 5 | 31751 | 6 | 140427 | 0 | § si +milar 84 | 250 | 13980 | 49501 | 11 | 5 | 31751 | 3 | 140427 | 1 | § si +milar 84 | 250 | 14380 | 49501 | 11 | 5 | 0 | 23 | 140427 | 1 | § si +milar 84 | 250 | 14390 | 49501 | 11 | 5 | 0 | 22 | 140427 | 1 | § si +milar 84 | 250 | 5490 | 150000 | 7 | 0 | 0 | 23 | 54964 | 0 | & si +milar 84 | 250 | 5300 | 150000 | 7 | 11 | 31609 | 6 | 54964 | 0 | & si +milar 84 | 250 | 5200 | 150000 | 7 | 11 | 31609 | 8 | 54964 | 3 | & si +milar (18 rows)

In reply to Re: Find similar records based on multiple column with multiple criteria by erix
in thread Find similar records based on multiple column with multiple criteria by ssc37

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.