I have 3 tables in my database. I connect tables "persons"-"domains"-> id\_person. Tables "domains"-"email"-> id.domain.

* persons
* domains
* email

```
SELECT 
    p.id, 
    p.name, 
    GROUP_CONCAT(e.adres_email ORDER BY d.domain_end SEPARATOR '<hr>') AS adres_email, 
    GROUP_CONCAT(d.domain_name ORDER BY e.adres_email SEPARATOR '<hr>') AS domain_names, 
    GROUP_CONCAT(DISTINCT d.domain_end ORDER BY e.adres_email SEPARATOR '<hr>') AS domain_ends
FROM 
    domains d
    LEFT JOIN persons p ON d.id_person = p.id
    JOIN email e ON d.id=e.id_domain
GROUP BY 
    p.id

```

Problem, when domain doesn't have a e-mail adres and when domain have more email address, because i score double domain name