sql - DISTINCT with GROUP BY in MySQL -


if i'm selecting distinct values, group results, values distinct within each grouping, or across groupings?

for example:

month | id       |   01  | 17    01  | 17    01  | 19   04  | 17   04  | 20 

if run

select month, count(distinct id) table group month 

what counts 2 months?

you 2 each month.

here sql fiddle showing results.


Comments

Popular posts from this blog

php - Auto increment employee ID -

php - isset function not working properly -

python - Evaluating the next line in a For Loop while in the current iteration -