MySQL showing total members in factions/online members.
#2

You'll want to use "group by". Bascially what you want to do is this:
PHP код:
SELECT factionidCOUNT(factionid) AS memberCount FROM Accounts GROUP BY factionid 
That will then produce a list of factionids and the number of rows for each. To add the name you need to join the other table. I'm not sure if the query below is entirely correct because I don't have a database to test it with.
PHP код:
SELECT a.factionidf.NameCOUNT(a.factionid) AS memberCount FROM Accounts a INNER JOIN Faction f ON f.ID a.factionid GROUP BY a.factionidf.Name 
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)