Question: I would like to check every so often if exists a new version of my app, and if it´s, show a message to user. I use Firebase, connecting and comparing version from remote config with current version of app. This isn´t the problem, my problem is how to show the dialog at any time, in any activity. 

I have a BaseActivity, where I have methods to connect with firebase and to show the message when it answers. Furthermore, I have a method that executes every hour this update checking:

```
    private void checkUpdate() {
        handlerCheckUpdate.postDelayed(() -> {
            getConfigFromFirebase(this);
            checkUpdate();
        }, 3600000);
    }

```

And finally I have Activity1 and Activity2 that extends of BaseActivity. In my Activity1 I start the recursive checkUpdate method. 

The problem is that, if user is in Activity2 currently, when the message shows, it do it in Activity1 and not in Activity2.
What is the best solution to do this?.

Thank you very much!

Answer: 
You can get this result with a `JOIN`, by self-joining on the `color` field, where the name in the second table is `jose`:

```
SELECT a1.name, a1.color
FROM tableA a1
JOIN tableA a2 ON a2.color = a1.color AND a2.name = 'jose'

```

Output

```
name    color
jose    red
Rap     red

```

[SQL Server demo on SQLFIddle](http://sqlfiddle.com/#!18/5f7e3/5)

[Oracle demo on SQLFiddle](http://sqlfiddle.com/#!4/5f7e3/1)
If names have only one color, then you would seem to want:

```
select a.*
from tableA a
where a.color = (select a2.color from tableA a2 where a2.name = 'jose');

```

You might want to add another condition that `a.name <> 'jose'` if you don't want to return that row.