Thanks... you're really helping... there is one more query I am trying to figure out...
Code:
SELECT rank_players.*, SUM(sValue) as total FROM rank_players
INNER JOIN rank_scores USING(playerID)
GROUP BY playerID
ORDER BY total DESC, pName ASC
LIMIT $limit,$rebcount
This is a routine I am writing to do a general update of total rankings... it gets the player data, and then the sum of the Values of their scores. The $limit and $rebcount values are the start and end of the query... since its doing a general update, I have it looping on page refreshes and renewing the starts and ends of the select query with each iteration. So far it works great...
However, there is one thing I'm failing at figuring out...
The SUM(sValue) string... I want it to ONLY count the sum of values...
Code:
SELECT * FROM rank_scores
INNER JOIN rank_events USING(eventID)
WHERE rank_events.eDate > $cutoff
LIMIT $bestcount
How would I go about doing this? I know I can easily add the INNER JOIN and WHERE statement to the above code, but I cant add the LIMIT statement, because I am already using it. I know there is a way to nest sub-queries... but I cant figure it out...