[英]copy one row from a table to another and insert value of one column in same query
[英]Is there a way to bulk insert certain data from a query in SQL to another column with the same row within the same table?
如果我希望它们显示在同一行但在不同的列中,有没有办法比 1 比 1 更快地做到这一点?
如果我要一个一个地做,它看起来像
select recnum, toys from sales_report
where end_date like '%2022-05-01%' and toys like '%racecars%'
insert *whatever the select is* into new_column (in same table)
where recnum like '10048498'
但是,这将花费很长时间,因为我正在处理近 5000 条记录。 有没有办法批量插入或解决这个问题?
非常感谢你的帮助:)
ALTER TABLE SALES_REPORT 添加 TOYS_CODE varchar(256);
--从 SALES_REPORT 中选择 *
更新销售报告
SET TOYS_CODE = TOYS where end_date LIKE '%2022-05-01%' AND code LIKE '%RACECARS%'
这最终为我工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.