Skip to content
Advertisement

Join two table with Multiple cases in ON condition

I have two tables A and B and I have to perform left join on that with multiple cases in on condition. Is there any efficient way of doing this in big query or SQL.

Here my main motive is that for one row if my case1 matches than it will not go into other cases. Likewise it will work if first is not matches then it will check second, then third and it will get best possible one match. Here the cases will help that to get 100% of join between A and B table. In first cases we are checking all 5 fields of both table, but if some of the field are null than it will check other case and likewise it should work.

Advertisement

Answer

If I understand correctly, the general approach in SQL is multiple left joins:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement