![](/img/trans.png)
[英]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.