So my problem is that I have a query that uses the Mysql User-defined variable, for example: @x:=0 SELECT @X: =@X +1 from some_table , and this code returns a column from 1 to 1000.
However, this query does not work if I sent it via mySQLdb in Python.
connection =MySQLdb.Connect(host='xxx',user='xxx',passwd='xxx',db = 'xxx') cursor = connection.cursor cursor.execute("""SET @X:=0;SELECT @X: =@X +1 FROM some_table""") rows = cursor.fetchall() print rows
He prints an empty tuple.
How can i solve this?
thanks
zsljulius
source share