i have table similar to this:
ID | event | user | time | note | archived
I need the number of events that individual users have been to, but one user can have more than one record for one event, so I only need to count it once.
The result should look like this:
user | nrofevents
Thank you for any advice.
CodePudding user response:
Possibly it's just the use of distinct you need?
select user, count(distinct event) as nrofevents
from t
group by user;