MySQL:在一个表内克隆行

时间:2018-08-06 13:15:47

标签: php mysql database

我有一张桌子,下面是内容

stat_id|stat_type|stat_value
1      |likes    |100
1      |reposts  |150

是否可以在一个查询中为其他stat_id克隆这些行?

重要的是我们要为几个新的stat_id复制。

1 个答案:

答案 0 :(得分:0)

使用INSERT ... SELECT

insert into your_table (c1, c2, ...)
select c1, c2, ...
from your_table
where id = 1
相关问题