News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Database query to return locations of members

Started by bosswhite, November 01, 2018, 04:53:21 PM

Previous topic - Next topic

bosswhite

In my database I have a table smf_members

Within that table is a column country_flag

Each user selects from a pulldown menu when registering their country and a small flag of that nation is then shown under their name when posting.

So, within the column country_flag the content varies for each member (e,g. gb us ca etc.)

I want to be able to do a database query that will return the total number of members for each country code so I can determine the breakdown of member's locations.

Any idea how I could achieve that? Any help would be greatly appreciated.
I've been down so long now it's beginning to look like up..

Arantor

SELECT country_flag, COUNT(country_flag) AS number FROM smf_members GROUP BY country_flag;

bosswhite

Thank you very much for the swift response Arantor. It worked a treat.
I've been down so long now it's beginning to look like up..

Advertisement: