sql - joining two tables and overwriting one colum -
i trying join tables image attached shows,
table 1 have same records table 2 except 1 field not equal
i merge them have extended table :
have records table2, if ignore isempty field, table 1 in table2
when table1.isempty=1 , merged result have isempty=1, , record overwritten
check attached images more details
the table 3 shown, have records table 2 overwritten when necessary
select a.id, a.name, a.desc, case b.isempty when 1 1 else a.isempty end case isempty table2 left join table1 b on a.id=b.id
Comments
Post a Comment