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

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -