sql根据A表内容对应B表字段提取内容

2025-04-22 12:55:16
推荐回答(1个)
回答1:

update table1 set JE =
(
case tabl1.RQ
when 'D1' then table2.D1
when 'D2' then table2.D2
when 'D3' then table2.D3
when 'D4' then table2.D4
when 'D5' then table2.D5
when 'D6' then table2.D6
when 'D7' then table2.D7
else null
end
)
where table1.GH=table2.GH and table1.Month=table2.Month