I have the following problem.
ZQuery1.SQL.Text:=
' SELECT '+
' IF(q.rank2 = 1, @rank:= 1, @rank:= @rank + 1) AS rank '+
' ,q.* FROM ( '+
' SELECT groep.id - MinGroepId(groep.id) AS rank2 '+
' ,groep.otherfields '+
' FROM groep '+
' ORDER BY rank2 ) q; ';
ZQuery.Open;
When I run this code I get an exception Incorrect token followed by ":"
in ZQuery1.
How do I fix this? I need to use Delphi, because I cannot put this select in a MySQL procedure.
Zeos 6 does not support MySQL procedures that return a resultset.
P.S.
I'm using Delphi 2007 and MySQL 5.1 with ZEOS 6.6.6.
Although I'm pretty sure the versions don't matter.
I'm not willing to switch versions as I'm too far into the project.