title: Cardinality violation on mysql query
body: <p>Im getting an error on this query: </p>
  
  <pre><code>SELECT i.name, i.surname, (SELECT u.username FROM user u WHERE u.info_id IN (1,9,10,15,25,40,42,43,44)) as email FROM `userinfo` i WHERE i.id IN (1,9,10,15,25,40,42,43,44)
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Cardinality violation: 1242 Subquery returns more than 1 row</p>
  </blockquote>
  
  <p>I know this could be solved by using a JOIN statment but i have no idea how to solve that.</p>
  
  <p>To clarify more my question, I have two tables, user and userinfo:</p>
  
  <p><em>User</em></p>
  
  <pre><code>id info_id username
  </code></pre>
  
  <p><em>Userinfo</em></p>
  
  <pre><code>id name surname 
  </code></pre>
  
  <p>The info_id row from <code>user</code> is related to the id of <code>userinfo</code>, so having a list of userinfo ids in this format (1,4,7,8,9) I want name and surname (from <code>userinfo</code>) and username from <code>user</code> that match the info_id</p>