I’ve got two tables:
TableA
Col1
Col2
TableB
Col3
Col4
I want to join them together:
SELECT * from TableA join TableB ON (...)
Now, in place of ... I need to write an expression that evaluates to:
- If Col3 is not null, then true iif Col1==Col3; otherwise
- If Col3 is null, then true iif Col2==Col4
What would be the most elegant way to do this?
should do the trick (if Col3 is null, Col1=Col3 cannot evalutate to TRUE)