How to select multiple avg(column) in one select statement in MySql stored procedure? -
i find when select 1 avg(column) variable,it ok.but when select more 1 avg variable,it wrong.i not want write twice,how fixed it?
//work select avg(mathpoint) mathpoint student sex=1 select avg(englishpoint) englishpoint student sex=1 //do not work select avg(englishpoint) englishpoint, avg(mathpoint) mathpoint, student sex=1
you have syntax error on into
usage.
into
should follow variable names after selecting fields.
example:
select avg(englishpoint), avg(mathpoint) englishpoint, mathpoint student sex=1
documentation:
- select ... syntax
select ... var_list
selects column values , stores them variables.
Comments
Post a Comment