I have a situation where I would require to do a conditional join based on the value of the columns on one of the tables.
table_a ta
join table_b tb on
case
when ta.column_1 = 1 then ta.column_2 = tb.column_2
when ta.column_1 = 2 then ta.column_2 = tb.column_2 and ta.column_3 = tb.column_3
when ta.column_1 = 3 then ta.column_2 = tb.column_2 and ta.column_3 = tb.column_3 and ta.column_4 = tb.column_4
end
Please advise how I should go about it?
Tried searching and got some options to use a left join but I am not sure how to do it. 🙁
Please advise.
i think it’s all can be formulated as single boelean expression