两表更新查询SQL

select a.column2,a.column3,a.column4,a.column5,a.column6,a.column7,b.column2,b.column3,b.column4,b.column5,b.column6,b.column7
from T_Column17 a
inner join T_Column17 b on a.column2 = b.column2 and a.column2 <> '' and a.column2 <> 'size' and a.column49 = '01'
where b.column2 <> '' and b.column2 <> 'size' and b.column49 = '02'

update b
set b.column7 = a.column6,b.column6 = cast((cast(b.column5 as int) - cast(b.column7 as int)) as varchar)
from T_Column17 a
inner join T_Column17 b on a.column2 = b.column2 and a.column2 <> '' and a.column2 <> 'size' and a.column49 = '01'
where b.column2 <> '' and b.column2 <> 'size' and b.column49 = '02'

update a
set a.KSMC = b.name
from JC_KSXXB a
inner join chisdb_ymyy..zd_unit_code b on a.KSDM = b.code

posted @ 2022-02-24 15:00  淡淡的思绪  阅读(102)  评论(0)    收藏  举报