我选择了我的数据;SELECT * FROM item_temp WHERE name LIKE '%starter%' AND Inventory LIKE '600';
我想复制所选数据(而不是覆盖数据),将查询中每个项目的“输入”值乘以10。
例如,一项的“输入”是:51327。
我想复制条目513270。
我尝试了几种不同的方法,但是它们都导致了错误,并且感觉就像在砖墙上。
提前致谢。
最佳答案
像这样:
select (it.entry * 10 + n) as entry, . . . -- the rest of the columns go here
from (select 0 as n union all select 1 union all . . . select 9) n cross join
item_temp it
where it.name LIKE '%starter%' AND it.Inventory LIKE '600' ;
关于mysql - 复制所选数据并增加条目ID,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54330945/