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