Joining Two Tables on dynamic Columns
123

We have two table A and B which are joined using three columns say col1,col2,col3.
The requirement is If one column is null then joining condition should be on remaining two columns . If two columns are null then joining condition is on single column.

Example1:
If Col1 is Null then

select * from A,B
where a.col2=b.col2 and a.col3=b.col3;

If Col1 and col3 are Null then

select * from A,B
where a.col2=b.col2 ;

Thanks

Comments (1)