'how to apply case when on two tables
I have a question
I have two tables table A and table B
Now I want to update a flag as 1 when records are common in both the tables and update flag as 0 when no common records are there . Adding a snippet from my code
dataframe = spark.sql("""select b.*
from ( Select *
from db.A
where source = 'fileFormat.xlsx'
) a
left join table B b on a.column1 = b.column1
and a.column2 = b.column2
and a.column3 = b.column3
where b.column2 is not null
""")
In layman's language how do i find the common records and update the flags.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
