Just use a case
expression:
create table joinedTable as
select a.unique_number, a.monthly_spend, b.unique_number,
b.email_preference, b.client_tier,
(case when b.unique_number is null then 1 else 0 end) as flag
from table2019 a left join
table2018 b
on a.unique_number = b.unique_number;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…