# Find the intersection of two tables

**URL:** https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860
**Category:** Ask for Help
**Created:** [August 26, 2022, 7:51pm UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860 "2022-08-26T19:51:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [August 26, 2022, 7:51pm UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/1 "2022-08-26T19:51:31Z")

</div>

I filter a table to get all rows owned by user A.

I then want to compare this set of data (the name column) to a second table to find the intersection of the two tables (table1.name == table2.name).

Here is the example:

All accounts owned by Bob (list of accounts) (a relation created by matching Bob)  
All accounts owned by Triumph (list of accounts) (a regular table e.g. all rows are owned by Triumph)

The question being asked/answered:  
How many accounts matching Bob also match Triumph?

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [August 26, 2022, 9:39pm UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/2 "2022-08-26T21:39:31Z")

</div>

This may have worked:

Triumph table with column called AccountName  
Partner table with column - AccountName and column - RepName

Created a relation with Partner table (match on Bob) rel-\>BobsAccounts  
Created “JL” a Joined List column on rel-\>BobsAccounts (joined on AccountName)  
Created a Split List column on “JL”  
Created a relation with Triumph table (match on the split list)

Seems to have worked, I get a subset of accounts.

Is this the correct method to compare the results of a relation against a table?

And will this scale to 1000s of records (current test was 100s of records against 2,000 records)?

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [August 26, 2022, 10:18pm UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/3 "2022-08-26T22:18:21Z")

</div>

> [@MattLB](#):
>
> Created “JL” a Joined List column on rel-\>BobsAccounts (joined on AccountName)  
> Created a Split List column on “JL”

You could shortcut this by just using a Lookup column instead, which will give you an array, instead of converting an array of values into a string using a Joined List, just to turn around and flip it back to an array with a Split Text.

Otherwise, I think you did everything else how I would.

---

<div class="post-metadata">

### Author: ![MattLB](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/mattlb/32/41284_2.png) [@MattLB](https://community.glideapps.com/u/MattLB)
#### Post date: [August 26, 2022, 11:10pm UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/4 "2022-08-26T23:10:51Z")

</div>

Will totally try this since I have not used lookup in this manner! Love this functionality - does it scale?

I get frustrated with Glide more than I should, but, dammit, Glide can be spectacularly awesome at times.

Quoting Tom Petty - “it seems I remember the good times were just a little bit more in focus”

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [August 27, 2022, 3:50am UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/5 "2022-08-27T03:50:04Z")

</div>

It should scale just fine.

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)
#### Post date: [August 28, 2022, 3:50am UTC](https://community.glideapps.com/t/find-the-intersection-of-two-tables/47860/6 "2022-08-28T03:50:45Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
