KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
So My problem is this, I have a query that uses Mysql User-defined variable like: @x:=0 SELECT @X:=@X+1 from some_table and this code returns a column from 1-1000. However, this query doesn't work if I sent it through 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 It prints a empty tuple. How can I solve this? Thanks
Tags (comma-separated)
Save Edits
Cancel