赞
踩
create table student (
id string,
age string,
name string,
dt string
);
insert into table student values
("1","11","zhao","20140101")
,("2","22","qian","20140102")
,("3","33","sun","20140103")
,("4","44","li","20140104");
select * from student;
create table student_temp( id string, age string, name string, dt string ); insert into table student_temp values ("1","11","zhao","20140101") -- 原本数据 ,("2","999","test","20220323") -- 改动 ,("3","999","test","20220323") -- 改动 ,("4","44","li","20140104") -- 原本数据 ,("5","55","wang","20140105") -- 新增数据 ; select * from student_temp;
select * from student_temp a full outer join student b on a.id = b.id;
SELECT student_temp.id
,coalesce(student_temp.age,student.age) as age
,student_temp.name
,coalesce(student_temp.dt,student.dt) as dt
FROM student_temp
FULL OUTER JOIN student
ON student_temp.id = student.id
;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。