mysql - User variables - fighting syntax -


Can anyone set up my MySQL syntax directly? I am trying to install a user variable called "seconds" which is equivalent to the output of the query below (and it works by itself), but I have an "error in your SQL syntax" errors I am constantly getting.

  SET @ seconds = average (T.Pop-T 1.poke) Tmp_4045_metrics AS t1, tmp_4045_metrics AS T2 WHERE t1.seq + 1 = t2.seq  

I have tried the selection AVG ...., (AVG ...), and much more, but there is always a single error warning that my syntax is false and sometimes it says That's why it's not wrong.

Can someone tell me in the right direction?

Thank you, Rich

If I miss it correctly (and this Works on MS SQL Server at work), then it should do this:

  @ seconds = Select AVG (T.Pop-T1poke) tmp_4045_metrics AS from T1, Tmp_4045_metrics AS T2 WHERE t1.seq + 1 = t2.seq  

Comments