SQL distinct for 2 fields in a database

前端 未结 5 1782
时光取名叫无心
时光取名叫无心 2020-12-04 17:35

Can you get the distinct combination of 2 different fields in a database table? if so, can you provide the SQL example.

5条回答
  •  感动是毒
    2020-12-04 18:07

    How about simply:

    select distinct c1, c2 from t
    

    or

    select c1, c2, count(*)
    from t
    group by c1, c2
    

提交回复
热议问题