SQL distinct for 2 fields in a database January 28, 2023 by Tarik How about simply: select distinct c1, c2 from t or select c1, c2, count(*) from t group by c1, c2