Skip to content
Advertisement

Hive Case Resulting Duplicate Row

I have a table containing contact numbers and another reference table containing a “length” variable and a number column. What I need is to find the prefix name where the prefix of the number matches the one in the reference table, but it should be the one that goes with the longest prefix matching. (omg I hope that make sense)

What I’ve tried so far:

However it still returns duplicate result, i.e: if the number is 12345, it matches the reference with prefix 1234 and 123, while I actually just want the 1234 one.

Is there any way to like prioritize the case? Thanks

An example of the data in the two tables: example

My current result and the desired result: results

Advertisement

Answer

Ok I reworked it, try this:

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