I did try defining it before the IF statement, but still the same ?
On Mon, Sep 27, 2010 at 7:58 AM, Johan De Meersman <vegivamp@stripped>wrote:
> At a guess, because you use @team in an if statement before you actually
> define it.
> On Sun, Sep 26, 2010 at 12:35 AM, Tompkins Neil <
> neil.tompkins@stripped> wrote:
>> I've the following query
>> SELECT teams_id AS teams_id ,SUM(rating) AS total_team_rating FROM (SELECT
>> teams_id ,players_id ,rating ,IF(@team <> teams_id, @row := 1, @row :=
>> + 1) AS rank ,@team := teams_id FROM ( SELECT players.teams_id
>> ,players.players_id ,players_master.rating FROM players JOIN
>> 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
>> s1) s2 WHERE rank <= 11 GROUP BY teams_id ORDER BY total_team_rating DESC
>> I'm running MySQL 5.0.77. However, if I run this query nothing is
>> but if I run the query again I get the desired results. Why is this ?
> Bier met grenadyn
> Is als mosterd by den wyn
> Sy die't drinkt, is eene kwezel
> Hy die't drinkt, is ras een ezel