i cannot update a column by using a cloumn in the same table in mysql -
i want calculate letter grade using average column.
i tried code:
update students set letter_grade='ba' (average- (select avg(average)from students )) > 20 , (average-(select avg(average)from students)) < 25;
but gives following error: you cant specify target table 'students' update if clause.
it seems mysql not allow update table using select same table. how can solve problem?
try this
update students set letter_grade='ba' group average having (average - avg(average)) > 20 , (average - avg(average)) < 25
Comments
Post a Comment