10.01.2017, 17:12
Yes. GROUP BY does that and it produces one result set that can be read in one go. I usually switch the columns around so groupid is first and member count is second, but it shouldn't matter. A query like this:
produces a result like this:
PHP код:
SELECT member AS factionId, COUNT(*) AS memberCount FROM Player GROUP BY member
factionId | memberCount |
2 | 10 |
4 | 8 |
7 | 13 |