SQL distinct for 2 fields in a database


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

Best Solution

How about simply:

select distinct c1, c2 from t


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