Sep-26-2017, 10:04 PM
Hello, I am pretty new to python
I am wondering is this is the correct syntax to get the last row id in a my=sql mysql table?
I am wondering is this is the correct syntax to get the last row id in a my=sql mysql table?
cur=conn.cursor() sql="SELECT row_id FROM test_tb ORDER BY row_id DESC LIMIT 1" cur.execute(sql) last_id = cur.fetchone() for lastID in last_id: print(lastID)Thanks.