MySQL for a ranking system

Associate
Joined
7 Dec 2007
Posts
302
Location
Derbyshire, Tibshelf
Currently having a problem with a statistics page in which players are ranked first by their population, then by their exploration amount... but what I would think works, doesn't seem to :/

First off it worked perfectly, but then adding the extra table (contains u_id and map_id of explored square)

Code:
SELECT a.u_id, a.u_name, a.clan_id, b.clan_id, b.clan_tag, count(c.u_id), SUM(c.vill_pop), count(d.map_id)

FROM user a LEFT JOIN clan b ON (a.clan_id = b.clan_id), village c, explore d

WHERE c.u_id IS NOT NULL
AND a.u_id = d.u_id
AND a.u_id = c.u_id
AND a.u_id <> '1'
GROUP BY a.u_id
ORDER BY c.vill_pop DESC

Village count (count c.u_id) comes out with the value of count(d.map_id) and total population comes out with 35,25,25 for the three users (count c.vill_pop)

Its as though its calculating stuff rather than just adding it as additional values :/ Sorry if I haven't explained it enough :/
 
the problem seems to occur just by adding: explore d (which contains u_id and map_id)

dunno how adding one extra table messes it all up :/

I've even tried adding a unique table ID exp_id, but it still seems to randomly affect the other tables :@
 
Last edited:
Back
Top Bottom