我正在尝试从包含2列的表中删除值; twitch
和name
。
这是代码:
cur2 = db.cursor()
cur2.execute("SELECT twitch FROM Alan45wmzYGCc5C7TIMCdczrel.whitelist WHERE twitch NOT IN(SELECT twitch FROM Alan45wmzYGCc5C7TIMCdczrel.followers)")
result = cur2.fetchall()
db.commit()
for row in result:
unfollowers.extend(row[0])
unfollowers_join = '\n'.join(unfollowers)
print unfollowers_join
cur3 = db.cursor()
for x in follows:
cur3.execute("DELETE FROM Alan45wmzYGCc5C7TIMCdczrel.whitelist WHERE twitch = (%s);", (x,))
data_unfollower = (unfollowers_join)
db.commit()
result
是需要删除的值,而result
是cur2
查询,用于查找不匹配的值。