Query working on 5.1.43 and not 5.0.77

Query working on 5.1.43 and not 5.0.77

am 07.10.2010 11:19:25 von Tompkins Neil

--20cf30050c40e7aad204920363f7
Content-Type: text/plain; charset=ISO-8859-1

Hi,

My hosting company are only running MySQL version 5.0.77 and at this current
time are not planning on upgrading to at least my required version
of 5.1.43. My query in which I have some problems is shown below :

SELECT teams_id AS teams_id ,SUM(rating) AS total_team_rating FROM (SELECT
teams_id ,players_id ,rating ,@team ,IF(@team <> teams_id, @row := 1, @row
:= @row + 1) AS rank ,@team := teams_id FROM ( SELECT players.teams_id
,players.players_id ,players_master.rating FROM players JOIN players_master
ON players.players_id = players_master.players_id WHERE players.worlds_id =
1 AND players.red_cards = 0 AND players.injury_duration_remaining = 0 AND
players.teams_id > 0 ORDER BY players.teams_id, players_master.rating DESC)
s1) s2 WHERE rank <= 11 GROUP BY teams_id ORDER BY total_team_rating DESC

Basically the part of the statement "WHERE rank <= 11" has no affect in
version 5.0.77, but gives the desired results in version 5.1.43. Does
anyone have any suggestions on how to overcome this problem, since at the
current time I don't have the budget to move to another hosting company and
this is the only query which I have a problem with.

Thanks for any help.

Cheers
Neil

--20cf30050c40e7aad204920363f7--