You can use an INNER JOIN
which will return all rows that appear in both tables:
select t1.*
from table1 t1
inner join table2 t2
on t1.name = t2.name
If you need help learning JOIN
syntax, then here is a great visual explanation of joins
Question
I need to output data from one table but only if that customers name has shown up in another table and I'm not quite sure how get this to work. Thanks
Solution
You can use an INNER JOIN
which will return all rows that appear in both tables:
select t1.*
from table1 t1
inner join table2 t2
on t1.name = t2.name
If you need help learning JOIN
syntax, then here is a great visual explanation of joins
OTHER TIPS
This is a basic SQL query:
SELECT *
FROM t
WHERE t.name IN (SELECT name FROM t2);
There are other ways to express this. Are you new to SQL?