Say I've two tables - "Table1" and "Table2" in my MySQL database.
"id" primary key (auto\_increment) in "Table1" is the reference key in "Table2" - "tab\_id".

There could be zero or more "Table2" rows for one "Table1" row. 

Now I'm trying to do a search on one of the column in "Table2" say "email" column OR on one of the column in "Table1" say "address" and print "Table1" row values.

I see there are 3 possibilities:
1. Join
2. Sub-Query
3. Union

1 Join

```
SELECT * 
FROM Table1 t1, Table t2 
WHERE t1.id = t2.tab_id 
  AND (t1.address like '%str%' OR t2.email like '%str%');

```

-- This works fine, but when there are no rows in "Table2" relevant to "Table1" .. the JOIN will fail, hence output is in-consistent.

2 Sub-Query

```
SELECT * 
FROM Table1 t1 
WHERE t1.address like '%str%' 
   OR t1.id IN (SELECT t2.tab_id 
                FROM Table2 t2 
                WHERE t2.email like '%str%');

```

-- This works fine, but when there are two manys rows in "Table2" (say 5K) the query goes very slow :(

3 Union

```
SELECT 'relevant_columns' 
FROM Table1 t1, Table t2 
WHERE t1.id = t2.tab_id 
  AND (t1.address like '%str%' OR t2.email like '%str%')
UNION
SELECT 'relevant_columns' 
FROM Table1 t1 
WHERE t1.address like '%str%'
ORDER BY relevant_column

```

-- This works fine, may be create a view with a similar UNION, does the job.

Now, my question what is the correct way ... is it okay to call a UNION always?

MySQL Engine: MyISAM