# Conditional left join 2 dataframes when none of the columns are common

**URL:** <https://discourse.julialang.org/t/conditional-left-join-2-dataframes-when-none-of-the-columns-are-common/81401>\
**Category:** General Usage\
**Tags:** dataframes, flexijoins\
**Created:** [May 21, 2022, 12:05am UTC](https://discourse.julialang.org/t/conditional-left-join-2-dataframes-when-none-of-the-columns-are-common/81401 "2022-05-21T00:05:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![aplavin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aplavin/32/222056_2.png) [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Post date:** [May 21, 2022, 7:36am UTC](https://discourse.julialang.org/t/conditional-left-join-2-dataframes-when-none-of-the-columns-are-common/81401/2 "2022-05-21T07:36:57Z")

</div>

[FlexiJoins.jl](https://discourse.julialang.org/t/ann-flexijoins-jl-fresh-take-on-joining-datasets/79655) supports many table types, but not all. Specifically, I think it doesn’t work with `DataFrames.jl`.  
Joining by the condition you need is pretty easy and efficient with `FlexiJoins`:

```julia
julia> using Tables, FlexiJoins, IntervalSets

julia> tbl1 = (id = [1,101,1001], b = [1,2,3]) |> rowtable
julia> tbl2 = (id1 = [0, 95], id2 = [50, 150], c = [2,3]) |> rowtable

julia> leftjoin((tbl1, tbl2), by_pred(:id, ∈, r -> r.id1..r.id2))

```

Here, I use `rowtable` (vector-of-namedtuples) as the input table type for simplicity.

---

_[View the full topic](https://discourse.julialang.org/t/conditional-left-join-2-dataframes-when-none-of-the-columns-are-common/81401)._
