The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I'm a webmaster relatively inexperienced with databases and mySQL, so I am looking for any sort of pointer in the right direction like this. I've attempted to write a few SUM statements (is that even what you call them? statements?) using resources around the web, but I just can't seem to get this right.
I have two tables user and userfield. In the user table I have the userid and usergroupid values. In the userfield table I have the userid and userfield16 (an integer value representing points) values. I would like to total the userfield16 points based on the usergroupid and have this value displayed on the forumhome index.php. Make sense? |
#2
|
||||
|
||||
![]()
This should do you for the sql;
[sql] SELECT usergroupid, SUM(userfield16) AS total FROM user LEFT JOIN userfield USING (userid) GROUP BY usergroupid [/sql] |
#3
|
|||
|
|||
![]()
Thanks for the quick reply!
I feel like I'm doing this completely incorrectly. This query gives me an array? Or what? I'm a complete noob at this, so here is my feeble attempt. I used the SQL that you gave me... PHP Code:
Code:
Unknown column 'userfield16' in 'field list' Thanks! |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|