Skip to content
Advertisement

How to join single table with multiple columns in Hive?

I have 2 tables: one has exchange rates (to GBP), the other has various amount columns with different currencies. I am joining these two tables and display all amount values in GBP, but I get nulls for many.

Here is the query joining these two tables

Advertisement

Answer

Since the currencies of the three different amounts can all vary, you cannot join the exchange rates just once. This will only find an exchange rate record, if the currencies are all the same. So you get NULLs where the currencies differ as no exchange rate was found. Try to join it three times separately.

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