Count Male/Female Specific Usergroup
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #7
RE: Count Male/Female Specific Usergroup
Yeah, because the usergroup is in users table. You need to join userfields table with users table.

Something like this:

PHP Code:
1
2
3
4
5
6
7
8
$NumMale = $db->fetch_field(
	$db->query('
		SELECT COUNT(*) AS NumMale
		FROM '.TABLE_PREFIX.'users u
		LEFT JOIN '.TABLE_PREFIX.'userfields uf ON (u.uid=uf.ufid)
		WHERE u.usergroup=2 AND uf.fid3="Male"
	'),'NumMale'
);


(This post was last modified: 12-17-2017 04:32 AM by RateU.)
12-17-2017 04:28 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Count Male/Female Specific Usergroup - RateU - 12-17-2017 04:28 AM

 Standard Tools
Forum Jump: