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

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -