mysql - Using @variables:= in delphi query does not work -


i have following problem.

zquery1.sql.text:=    ' select                                                  '+   '   if(q.rank2 = 1, @rank:= 1, @rank:= @rank + 1) rank '+   '   ,q.* (                                            '+   '   select groep.id - mingroepid(groep.id) rank2       '+   '     ,groep.otherfields                                  '+   '   groep                                            '+   '   order rank2 ) q;                                   '; zquery.open; 

when run code exception incorrect token followed ":" in zquery1.
how fix this? need use delphi, because cannot put select in mysql procedure.
zeos 6 not support mysql procedures return resultset.

p.s.
i'm using delphi 2007 , mysql 5.1 zeos 6.6.6.
although i'm pretty sure versions don't matter.
i'm not willing switch versions i'm far project.

this can't done, can parameterize value. best can sql.text := stringreplace() lose speed of preparing queries.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -