批量修改数据sql

时间:2022-04-16 07:27:06

 

 

--insert into P_ZPROMOTION_DOC_ITEMS (AKTNR,MATNR,MINGROSS,MCRANK,MCUPRICE,MAXBAKTNR,MAXBPAMONT,MAXBPRICE,MINBAKTNR,MINBPAMONT,MINBPRICE) SELECT AKTNR4,MATNR,MINGROSS,MCRANK,MCUPRICE,MAXBAKTNR,MAXBPAMONT,MAXBPRICE,MINBAKTNR,MINBPAMONT,MINBPRICE FROM P_ZPROMOTION_SOURCE WHERE AKTNR4=5075

select * from P_ZPROMOTION_DOC_ITEMS where AKTNR='BL5075' and len (matnr)>0 --448 select * from P_ZPROMOTION_SOURCE where AKTNR4='5075' and matnr in (select matnr from P_ZPROMOTION_DOC_ITEMS where AKTNR='BL5075')

--批量修改数据

update P_ZPROMOTION_DOC_ITEMS set MINGROSS=b.MINGROSS,MCRANK=b.MCRANK,MCUPRICE=b.MCUPRICE, MAXBAKTNR=b.MAXBAKTNR,MAXBPAMONT=b.MAXBPAMONT,MAXBPRICE=b.MAXBPRICE,MINBAKTNR=b.MINBAKTNR, MINBPAMONT=b.MINBPAMONT,MINBPRICE=b.MINBPRICE from P_ZPROMOTION_DOC_ITEMS a,P_ZPROMOTION_SOURCE b where a.AKTNR='BL5075' and b.AKTNR4='5075' and a.matnr=b.matnr