Jump to content

What is wrong with this sum query?


t_machine

Recommended Posts

hi, I can't seem to figure out why the query is failing. I run it on my local host and it works but when placed online it fails.

$wpoints = query_db("select u_id, SUM(points) from table where b_id='2' group by u_id order by SUM(points)");

When I try to get a numrows it shows blank online but on local host it shows the correct amount.

The table contains u_id, points and b_id
The b_id is a category id, u_id is the user and then points.
The u_id is entered a number of times in the table with points. I would like to sum the points for each u_id and order them by the ones with the most points.

Any help would be greatly appreciated :)
Link to comment
https://forums.phpfreaks.com/topic/27335-what-is-wrong-with-this-sum-query/
Share on other sites

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.