0
我想用不同的值更新多行。用不同的值更新多行python和mysql
例如我的表是:
ID |名稱|數據
1 | ahmad |年2015
2 | ali | 2014年
我希望我的表看起來像這樣:
ID |名稱|數據|號碼
1 | ahmad | 2015年| 2
2 | ali | 2014年| 3
有超過7000行我不能一一填寫。
我試圖在Python這樣做的查詢是:
#words count in a tweet
words= processedRow.split()
fdist2=len(words)
for val in cursor.fetchall():
cursor.execute("""UPDATE TWEETER1 SET t1=%s where id = %s""",(fdist2,val))
db.commit()
請幫助我做我的工作。謝謝
你能幫我查詢嗎? – SmartF