MySQL将一张表的某些列数据,复制到另外一张表

INSERT INTO t_topic_content(content,topicId) SELECT content,id FROM t_topic;

注意:给某一列数据赋值,自增长,那么就不应该插入数据了


MySQL将一张表的某些列数据,复制到另外一张表,并且修改某些内容。方法同上, 只是查询的时候使用REPLACE(str,from_str,to_str) 函数

INSERT INTO t_topic_content(content,topicId)
  SELECT REPLACE(content, 'aa', 'bb'),id FROM t_topic

相关文章:

  • 2021-11-06
  • 2021-12-27
  • 2021-11-02
  • 2021-06-27
  • 2021-11-08
  • 2022-01-14
  • 2021-08-10
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
相关资源
相似解决方案