[sql] How to return only 1 row if multiple duplicate rows and still return rows that are not duplicates?