Jump to content

need help with correct GROUP BY (might be something else) :)


xwishmasterx

Recommended Posts

I have a simple code that should count my online members for a team:

 

$online_members = mysql_query ("SELECT count(vtp_tracking.credit_members_id) as members FROM vtp_tracking WHERE action_date>date_sub(NOW(),interval 10 minute) AND teamid=".$rsget_team_id['team_id']." GROUP BY credit_members_id")
  or die(mysql_error()); 
$rs_online_members = mysql_fetch_array( $online_members );

 

my problem is getting the actual count, as I get the wrong amount of online members. Basicaly I count the unique member id where the team id is the same as the user (teamid=".$rsget_team_id['team_id']." ).

 

What should I group by to count the numbers of different "vtp_tracking.credit_members_id" ?

From what I gather, you are probably wanting to group by the teamid. But, since you're already filtering out all the other teams except the one you want, you don't need the GROUP BY clause.

 

That is what you want, right? The number of online members from a certain team?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.