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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.