Mysql count an acctual value:

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
I have this code at the moment:

PHP:
$sql = "SELECT user_id, count(points) AS count_points FROM trans WHERE type_id!='30' AND type_id!='40' GROUP BY user_id ORDER BY count_points DESC LIMIT 100";

but it isn't acctually counting the points. count_points to acctually be a tally of the amount of points each unique user_id has. Everytime a user earns points it is stored into the database, so it needs to add the value of every "point" field for that specific user! :)

Any help would be most appreciated.

Thanks
Tom
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
It looks OK at first glance.
Did you try without the WHERE clause ?
 
0
Close
use sum(points) instead of count(points)
 
0
Close
thanks scott :)

sdsinc thanks for your help - but the where clause is pretty important, and if I took it out... well :D but thanks :)
 
0
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back