我需要更新 1000 行
这是我的桌子:
ID, name, keywords
1, foo, NULL
我需要像这样更新:
ID, name, keywords
1, "foo", "free foo, how to foo free, download free foo"
1, "line", "free line, how to line free, download line foo"
假设你的表是 mytable 你可以这样做:
update mytable set keywords = concat('free ',mytable.name,'how to ',mytable.name,', download free ',mytable.name);
您可以使用这样的更新查询轻松完成此操作,您可以将名称连接到关键字字符串中。
update mytable set keywords=concat("free " , name , ", how to " , name , " free, download free", name);