sql count distinct values by a field code example Example: select count of distinct values sql SELECT COUNT (DISTINCT column-name) FROM table-name