Please provide us with some DDL (create table) commands and some sample data (insert). Also specify the desired output based on the provided sample data.
You also need to specify the relation between the rows in the table. What are the rules that define which row must be compared with a specific other row? Does a single row need to compare to a single other row? Or does it need to be compared to all other rows in the table?
** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **