I would like to count the number of installations of each Member in a table similar to this. But this count distinct drives me nuts...
MemberID | InstallDate
1 | Yesterday
2 | Today
1 | Today
3 | Today
The above table should produce something like this one..
MemberID | CountNumberOfInstallations
1 | 2
2 | 1
3 | 1
p.s. I know it sound's like homework, but it isnt.
It looks like the query you are looking for is:
SELECT MemberID, COUNT(*)
FROM Table
GROUP BY MemberID
The DISTINCT keyword is not required. If order is required, you can use:
SELECT MemberID, COUNT(*)
FROM Table
GROUP BY MemberID
ORDER BY MemberID ASC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With