SELECT a.entry_id, a.some_other_col, b.some_other_col FROM my_table a, my_table b WHERE a.entry_code != b.entry_code ORDER BY a.entry_id