I'm having trouble with this query in NodeJS.
SET @i = 0;
SELECT POSITION FROM (
SELECT name, @i:=@i+1 AS POSITION
FROM database.table ti WHERE name='Johny' ORDER BY points ASC) t WHERE name='Johny'
Query works in Heidi SQL without a problem, but when i execute it in Node, i get callback is undefined.
NodeJS code :
var query =
"SET @i = 0;"
+ " SELECT POSITION FROM ("
+ " SELECT name, @i:=@i+1 AS POSITION"
+ " FROM database.table ti WHERE name='Johny' ORDER BY points ASC) t WHERE name='Johny'";
mySQLconnection.query(query,function(err,rows){
console.log(rows);
});
Thank You in advance,