Mysql count an acctual value:

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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
It looks OK at first glance.
Did you try without the WHERE clause ?
 
0
•••
use sum(points) instead of count(points)
 
0
•••
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
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy — Zero Commission
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back