The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
SELECT COUNT - MySQL
$eventattendees = $DB_site->query("SELECT COUNT (raid_id) AS totalcount FROM dkp_raids r, dkp_raid_attendees a WHERE r.raid_id=a.raid_id");
Trying to get count of attendees where raidid = raidid of the raid I am viewing. Hope that makes sense. Thanks in advance |
#2
|
||||
|
||||
Try adding a GROUP BY raid_id at the end Be sure to group it by the fieldname on the right table. I noticed you have aliases there and hence you should use them to avoid ambigous field errors :up:
|
#3
|
|||
|
|||
$eventattendees = $DB_site->query("SELECT COUNT(raid_id) AS count FROM dkp_raid_attendees WHERE raid_id='2' GROUP BY raid_id");
I tried that, and I am getting this: Recorded Raid History for Upper Blackrock Spire Date Attendees Drops Notes Added by Value 02-12-05 Resource id #26 Raid #2 Renwo 15.00 02-11-05 Resource id #26 First raid Renwo 15.00 (Notice the resource id) I have also removed the alias and just imputting a number there for time being to avoid any other problems. |
#4
|
||||
|
||||
Change $DB->query to $DB->query_first and access the variable with $eventattendees['count']
|
#5
|
|||
|
|||
Thanks so much
|
#6
|
||||
|
||||
Glad you got it sorted
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|