簡體   English   中英

有沒有辦法將 SQL 中的查詢中的某些數據批量插入到同一個表中具有相同行的另一列?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM