# How to search & compare 2 (or more) rows with data in different tables

**URL:** <https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473>\
**Category:** Ask for Help\
**Created:** [September 29, 2021, 7:00pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473 "2021-09-29T19:00:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 29, 2021, 7:00pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/1 "2021-09-29T19:00:05Z")

</div>

Structure:  
Table1  
Name, Subname

Table2  
Subname, Nickname, Description

Input:  
Table1.Name 1  
Table1.Name 2

Output:  
Description WHERE Name1.Table2.Subname in Name2.Table2.Nickname

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [September 29, 2021, 11:05pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/2 "2021-09-29T23:05:07Z")

</div>

So let me try to rephrase this into non-SQL language.

You have two tables: Table 1 with 2 columns name & subname, Table 2 with 3 columns Subname, Nickname and Description. I assume the Subname columns in those two tables are related to each other.

You want to “search” with two inputs, which correlates to the name column in table 1, so basically 2 rows.

Then I’m not clear what you want to compare with the output to get the description. Can you explain?

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 30, 2021, 8:43am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/3 "2021-09-30T08:43:47Z")

</div>

You’ve completely understood me. So, what I want to see is all descriptions from table2 where subname from input1 matches nickname from input2. Let me show the example to be more clear:

Table 1  
WhiteColorBox | White  
BlackColorBox | Black  
ColorBox | BlackAndWhite

Table 2  
White | Black | Mix of white and black is very interesting  
White | Orange | Mix of white and orange  
White | Black | Use this mix for your pictures  
Black | White | Description to be filtered out

Then I input two strings from table1 (ideally search and select from dropdown list):  
WhiteColorBox  
BlackColorBox

Then it shows me all matches from table 2:

1. Mix of white and black is very interesting
2. Use this mix for your pictures

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 9:09am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/4 "2021-09-30T09:09:38Z")

</div>

> [@santer1982](#):
>
> Then I input two strings from table1 (ideally search and select from dropdown list):  
> WhiteColorBox  
> BlackColorBox

If your second choice was “ColorBox”, what would you expect the output to be?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 9:25am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/5 "2021-09-30T09:25:19Z")

</div>

Is this what you are looking for?

Note that if you select ColorBox as both options, you get zero matches. I’m not sure if that is expected behaviour or not.

Anyway, to get the above:

- Write the two choices to user specific columns in table 1
- Create 2 single value columns in table 2, each of them fetching the corresponding user specific column from table 1
- Create an if-then-else column in table 2:
  - If Nickname is sv1, then true
  - If Nickname is sv2, then true

- Finally use an inline list and filter where the if-then-else is true

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 30, 2021, 9:36am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/6 "2021-09-30T09:36:04Z")

</div>

> [@Darren\_Murphy](#):
>
> If your second choice was “ColorBox”, what would you expect the output to be?

Nothing as no match found.

> [@Darren\_Murphy](#):
>
> Is this what you are looking for?

Many thanks for your answer. I will try to investigate it.  
As for your picture, it works the wrong way.

1. WhiteColorBox+WhiteColorBox should get empty result as there are no matches White+White in table 2. The same for BlackColorBox+BlackColorBox.
2. ColorBox+BlackColorBox should get empty result as there are no matches BlackAndWhite+White in table 2
3. BlackColorBox+WhiteColorBox should only get “Description to be filtered out”. It doesn’t seem logical, I understand.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 9:48am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/7 "2021-09-30T09:48:40Z")

</div>

Okay, so…

- Choice 1 should match Table 2 → SubName
- Choice 2 should match Table 2 → Nickname
- And both should be true

Yes?

To get that, you just need to adjust the if-then-else column. Instead of:

> [@Darren\_Murphy](#):
>
> - If Nickname is sv1, then true
> - If Nickname is sv2, then true

It should be:

- If SubName is not sv-1, then empty
- If Nickname is not sv-2, then empty
- Else true

After making that change:

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 30, 2021, 11:10am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/8 "2021-09-30T11:10:19Z")

</div>

> [@Darren\_Murphy](#):
>
> It should be:
> 
> - If SubName is not sv-1, then empty
> - If Nickname is not sv-2, then empty
> - Else true

Yes, now your picture looks correct but I cannot get how to implement it.  
I created an if-then-else column in table 2 which does not contain column Subname.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 11:20am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/9 "2021-09-30T11:20:58Z")

</div>

I followed your original example:

> [@santer1982](#):
>
> Structure:  
> Table1  
> Name, Subname
> 
> Table2  
> Subname, Nickname, Description

 ![Screen Shot 2021-09-30 at 7.16.55 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/5/5543f24e1643ef1ef8d40afefb5ddca515391215.png)

Here is a link to the app I created it in, you can make a copy…

> **[Untitled spreadsheet](https://belligerent-history-3508.glideapp.io/)**

There are some extra tables, but just ignore those - this is just an app I muck around with to test things with. Your stuff is in Table 1 and Table 2

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 30, 2021, 11:38am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/10 "2021-09-30T11:38:39Z")

</div>

> [@Darren\_Murphy](#):
>
> I followed your original example:

Yes, this was my mistake. I figured it out.  
Thank you so much! This is really what I wanted to achieve.

BTW, if there are thousands rows in table 1… is there a search option in choice picker?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 11:41am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/11 "2021-09-30T11:41:22Z")

</div>

> [@santer1982](#):
>
> BTW, if there are thousands rows in table 1… is there a search option in choice picker?

Yes. If you use a choice picker in standard (non-segmented) mode, then you’ll get a search box.

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [September 30, 2021, 12:29pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/12 "2021-09-30T12:29:49Z")

</div>

> [@Darren\_Murphy](#):
>
> Yes. If you use a choice picker in standard (non-segmented) mode, then you’ll get a search box.

I cannot see it.

 ![Снимок экрана 2021-09-30 в 15.25.35](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/e/4e7039792ca35c848a9296342c2f3f3e026fea6f.png)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [September 30, 2021, 12:31pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/13 "2021-09-30T12:31:37Z")

</div>

That’s because you only have 3 choices.  
Add more and it will appear.

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [October 18, 2021, 12:19pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/14 "2021-10-18T12:19:13Z")

</div>

Hello,  
Now when I have thousands of rows I have a problem with search.  
The app is here: [pills-app.net](http://pills-app.net)  
I open a second tab where there is just a list of items and put Nurofen. As supposed I get results.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/4/04f19f922117ae7098d9b4db44f1861aa1944310.jpeg)

Then I open a third tab and in the first active choice box I put the same text Nurofen, I get just one row, not plenty of them as in the previous step. I expect to get the same results as both elements (a list of items in the database and active choice) have the same source database.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/f/5fcb326ed6bd1b5ce9844aba594f899ec474cb5b.png) ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/1/91fadc8342f1f34968bf82ccbd12ab2d1d548fa4.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 18, 2021, 12:38pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/15 "2021-10-18T12:38:43Z")

</div>

How many rows do you have in total?

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [October 18, 2021, 1:46pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/16 "2021-10-18T13:46:02Z")

</div>

In that list 17k

---

<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:** [October 18, 2021, 3:11pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/17 "2021-10-18T15:11:14Z")

</div>

Can you show the settings for your choice component? I may be wrong, but I think the choice component will eliminate duplicates, because there is no use in showing the same choice multiple times. Most importantly, I’m curious what your Value and Display As settings are for the choice component. Do you have the Value set to column that’s the same for all Nurofren rows, so it’s only picking the first one to show?

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [October 18, 2021, 5:04pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/18 "2021-10-18T17:04:37Z")

</div>

> [@Jeff\_Hager](#):
>
> Can you show the settings for your choice component?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/b/eb061789fd2f00620fe4ecbfcf2f8dc13c96507d.png)

> [@Jeff\_Hager](#):
>
> Do you have the Value set to column that’s the same for all Nurofren rows

Yes, I have

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/1/9157d9e927f1c1b83209092537b202fd57d9deac.png)

---

<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:** [October 19, 2021, 2:40am UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/19 "2021-10-19T02:40:11Z")

</div>

hmm, so I assume the Main\_component column is the second column you are showing in your screenshot? If my theory is correct, then that would mean that you should at least see two values in your list of choices, since what I see are two unique Main\_component values. But it’s only a guess and doesn’t seem to match what you are experiencing. Is it true that the second column you are showing of your data is the Main\_component column? I can’t tell, since you didn’t include the headers.  
Are you sure you don’t have some sort of filter on your choice component? Are you limiting the number of items visible in the choice component?

If you believe that everything is set up correctly…based on what I’m seeing, I would expect the list in the choice component to be smaller, but only because glide may be trying to eliminate items that may be duplicates base on the column you selected for your ‘Value’ setting. Another thought is that the large number of rows are causing some bugs to surface.

As an alternative, you could consider creating your own kind of choices screen. This would require you to first have a new sheet with a single row that will act as your tab. You will need a template column that can be filled with the word ‘key’. Create a similar template in your pills table. Then create a single relation in your pills table that links the key template to the key template in the new table. Your tab will use the new table. Now instead of a choice components, you could have two buttons. The action for each button would be ‘Show New Screen’. On each screen, you would add an inline list. The action on the inline list would be to Set Column and write that Main\_Component value through the single relation in the pill table to a user specific column in your new table. So basically we would get rid of the choice components and create your own with Buttons, New Screens, Inline Lists, and Actions. I think it would work very similar and actually might work better if the choices are reacting the way I think they are and eliminating duplicate values.

---

<div class="post-metadata">

**Author:** ![santer1982](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/santer1982/32/32453_2.png) [@santer1982](https://community.glideapps.com/u/santer1982)\
**Post date:** [October 19, 2021, 12:44pm UTC](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473/20 "2021-10-19T12:44:22Z")

</div>

> [@Jeff\_Hager](#):
>
> Is it true that the second column you are showing of your data is the Main\_component column? I can’t tell, since you didn’t include the headers.

Yes, it is true. I’ve shown it on the screen, but the forum engine cut the preview, just click on the picture to open it in full size and you will see headers.

> [@Jeff\_Hager](#):
>
> Are you sure you don’t have some sort of filter on your choice component? Are you limiting the number of items visible in the choice component?

There is no filtering or limitation in the choice component.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/d/2d8d2d296e962879dd3eb7051cdfee0a00a5e32c.png)

> [@Jeff\_Hager](#):
>
> glide may be trying to eliminate items that may be duplicates base on the column you selected for your ‘Value’ setting

It would be strange but in any case this guess seems to be incorrect as even in this example there are 2 different values that must be displayed while only one is. I also have examples where no data is displayed.

> [@Jeff\_Hager](#):
>
> Another thought is that the large number of rows are causing some bugs to surface.

This seems to be true.

I would try to think of what you supposed next but how glide can fix what I described above?

[Next page](https://community.glideapps.com/t/how-to-search-compare-2-or-more-rows-with-data-in-different-tables/32473.md?page=2)
