mysql update with subquery 2 level deep -
thanks taking @ question. i'm kind of lost , hope can me. below update query run.
query returns error:
1054 - unknown column 'spi.et_cross_rank' in 'where clause'
some background:
table: tmp_ranking_tbl
nth(spi.et_return_rank) record
group value x (spi.et_cross_rank)
set @rownum=0; update strtoer_poule_indeling spi set spi.team_id = (select r.team_poule_id (select @rownum:=@rownum+1 rownum, trt.team_poule_id tmp_ranking_tbl trt trt.overal_rank = spi.et_cross_rank order trt.punten desc, (trt.goals_voor - trt.goals_tegen) desc, trt.goals_voor desc) r r.rownum = spi.et_return_rank) spi.et_ronde = v_et_ronde , spi.poule_id in (select row_id strtoer_poules toernooi_onderdeel_id=v_onderdeel_id) ;
data in tmp_ranking_tbl looks like:
team_poule_id | punten | goals_voor | goals_tegen | overal_rank 65 | 6 | 10 | 10 | 2 69 | 6 | 9 | 10 | 2 75 | 7 | 11 | 4 | 2 84 | 6 | 6 | 8 | 2 112 | 5 | 7 | 7 | 2
thanks in advance help!
update after question in comment goal, i'll try keep short. :-)
query used on website keep scores of tournament. have odd number of teams going next round. @ point want select best number 3(spi.et_cross_rank) team across poules. setting saved in strtoer_poule_indeling rank per poule , 1st, 2nd or nth team(spi.et_return_rank). table tmp_ranking_tbl filled rank 3 teams across poules. when if filled 1st or 2nd, depedining on setting in strtoer_poule_indeling, record return.
subset of structure strtoer_poule_indeling table
row_id | team_id | et_ronde | et_cross_rank | et_return_rank 1 | null | 1 | 3 | 1
just check if have column named et_cross_rank on table strtoer_poule_indeling
the problem seems sql can't find column on table.
hope helps.
Comments
Post a Comment