Adamski Adamski - 7 months ago 16
MySQL Question

Can I use COUNT() and DISTINCT together?

I would like to count the number of rows from a mysql table and not to include duplicate entries,

Could I use

distinct
with
count()
?

Answer

Sure.

SELECT COUNT(DISTINCT column) FROM table;