I am working on a server program that has a connection to a MySQL database.
In one of my sql:s i need to use User-Defined Variables but i can't get it to work.
The sql looks something like this:
"SET @rank=0; SELECT id FROM (SELECT @rank:=@rank+1 AS rank ..." I'm wondering if it's not possible to have two "statements" ending with ";"in one PreparedStatement. When i run the sql in phpMyAdmin it works but from the server i get an exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT id FROM (SELECT @rank:=@rank+1 AS rank, id, ((`wrong_answer_count` / (`co' at line 1 Best regards veLr