I want to know how to complete this query correctly.

I wish to export a full list of votes from all ips used by an user.

---

My database have 3 tables storing the relatives data =>

votes = vote\_site\_id | vote\_ip | vote\_time

connexions\_ip = adresse\_ip | user\_id | connexion\_time

users = user\_id | user\_name | user\_ip

---

So actually I have this query to have all connexions\_ip from one user =>

```
SELECT c.adresse_ip, c.user_id, u.user_name
    FROM connexions_ip c 
    LEFT JOIN users u ON u.user_id = c.user_id
WHERE u.user_id = '1'

```

And this query to have all votes from one user =>

```
SELECT v.vote_site_id, v.vote_ip, v.vote_time, u.user_name
    FROM votes v 
    LEFT JOIN users u ON u.user_ip = v.vote_ip 
WHERE user_id = '1'

```

---

I tried with subquery but I have this error "#1242 - Subquery returns more than 1 row"

```
SELECT v.vote_site_id, v.vote_ip, v.vote_time, u.user_name
    FROM votes v 
    LEFT JOIN users u ON (
SELECT c.adresse_ip
    FROM connexions_ip c 
    LEFT JOIN users u ON u.user_id = c.user_id
WHERE u.user_id = '1'
)
 = v.vote_ip 
WHERE user_id = '1'

```

---

Thanks for your help.