Question: I have the following two tables:

```
Table Animes with columns:
Id, Name

Table Episodes with columns:
Id, Episode Number, Anime

```

I need to select all rows in Table **"Animes"** with limit 10, where have at least 1 row on Table **"Episodes"** with Anime = Name

In other words i need to select animes if they have at least 1 episode..

Could someone help me please? Thanks!!

Answer: 
you could use a select distinct for matching anime

```
select distinct id, name 
from animes.name 
inner join Episodes on animes.name = Episodes.Anime
limit 10

```
You can use `where exists` pattern:

```
   select id, name 
   from Animes
   where exists (select 1 from Episodes where Animes.name = Episodes.Anime)
   limit 10;

```

[SQL fiddle](https://sqlize.online/?phpses=null&sqlses=8c2aad216e288d634ac119a9e7052150&php_version=null&sql_version=mysql57)