I have two tables:
x
TABLE 1
name age year
John 20 2001
Amy 21 2002
Table 2
name age year
John 20 2001
Kal 21 2000
SELECT * FROM Table1 AND Table2 WHERE name = 'john';
I tried using the statement above but it would not work.
I need the statement to return all the tables that have the word john in it.
Advertisement
Answer
You want union all
:
select name, age, year
from table1
where name = 'John'
union all
select name, age, year
from table2
where name = 'John'