I trying do join with ipv4 in table1 and range ipv4 table2:
table1: user_id(int), ipv4(type ipv4)
| Column A | Column B |
|---|---|
| 122222 | 1.0.0.1 |
| 323232 | 1.0.0.2 |
table2: range_start(type ipv4), range_end(type ipv4), country(string)
| Column A | Column B | Column C |
|---|---|---|
| 1.0.0.1 | 1.0.0.256 | US |
| 1.0.0.1 | 2.0.0.256 | JP |
I don't have idea how I can do this without using code python for example. I need do this via only sql. Maybe you have ideas?
I try imagine if I have CIDR in table2 and try this join:
table1 left join table2 on isIPAddressInRange(ipv4, CIDR), but it bot working in ClickHouse