如何update sql 批量更新?
表1中:有如下数据
OrderNo PO date HTS Quota
4200162 S110051 11/23/2010 6203434020 647
4200162 S110051 11/23/2010 6205202076 340
4200162 S110051 11/23/2010 6211330054 659
4200162 S110051 11/23/2010 6215200000 659
表2中
有字段OrderNo, PO , date,HTS,Quota等
我要将表1中的数据更新到表2中
请问如何写SQL语句?
更新
update t
set t.hts=o.hts,
t.quota=o.quota
from 表2 t,表1 o
where t.orderno=o.orderno and t.po=o.po
插入过去
insert into 表2(orderno,po,date,hts,quota)
select orderno,po,date,hts,quota from 表1
OrderNo PO date HTS Quota
4200162 S110051 11/23/2010 6203434020 647
4200162 S110051 11/23/2010 6205202076 340
4200162 S110051 11/23/2010 6211330054 659
4200162 S110051 11/23/2010 6215200000 659
表2中
有字段OrderNo, PO , date,HTS,Quota等
我要将表1中的数据更新到表2中
请问如何写SQL语句?
更新
update t
set t.hts=o.hts,
t.quota=o.quota
from 表2 t,表1 o
where t.orderno=o.orderno and t.po=o.po
插入过去
insert into 表2(orderno,po,date,hts,quota)
select orderno,po,date,hts,quota from 表1
SQL批量更新表1数据至表2实例
本文介绍如何使用SQL语句实现表1数据批量更新至表2,包括更新语句和插入语句的编写,适用于数据库操作场景。
5623

被折叠的 条评论
为什么被折叠?



