[英]What is the best way of duplicating around 1500 mysql entries in to the same table with a small change?
I have a number of entries in a database which are assigned to a specific account within my php application. 我在数据库中有许多条目,这些条目分配给我的php应用程序中的特定帐户。 I need to duplicate all of the entries with the account_id of 5 and give the duplicated entries an account_id of 6 so they can be edited independently by the 2 different accounts. 我需要复制account_id为5的所有条目,并将重复的条目的account_id设置为6,以便可以由2个不同的帐户独立地对其进行编辑。
Normally I'd just grab all the entries with an account_id of 5 then loop through them using php inserting a new entry for each one but with 1500+ entries I imagine that's not the best idea! 通常,我只想获取一个account_id为5的所有条目,然后使用php遍历它们,为每个条目插入一个新条目,但是有1500多个条目,我想那不是最好的主意!
Is there any way to do this with SQL? 有什么办法用SQL做到这一点?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.