oracle数据库,两张表 根据一个字段来匹配

2025-03-27 13:33:15
推荐回答(3个)
回答1:

select "职工号" from a table1 left join b table2 on table2.不变号 = table1.不变号

职工号在哪个表里面就在把  "职工号"  替换成  tableX.职工号

回答2:

update b set b.职工号=(select a.职工号 from a where a.不变号=b.不变号)
where exists (select 1 from a where a.不变号=b.不变号)

回答3:

假如相同字段为Name
SELELCT name FROM A
UNION ALL
SELECT name FROM B,
查出来会有重复的记录,用UNION 的话就没有重复记录