title: How to select from two tables with IF?
body: <p>I have 2 table in my DB, first is <code>users</code>, and second is <code>friends</code>.</p>
  
  <p>In the <code>users</code> tables I have a column named `friend' this columns have a random ID of each one, and this ID you used for calling someone to subscribe with your URL.</p>
  
  <p>but if an old person want to become your friend I add other table named <code>friends</code></p>
  
  <p>content the random ID + ID_USER</p>
  
  <p>now, I want to <code>SELECT * FROM users, friends WHERE users.friends = 'BlaBla' OR friends.RANDOMID = 'BlaBla'</code></p>
  
  <p>I try with this code, but I doesn't work, it's give all persons having the random 
  in calling friend</p>
  
  <pre><code>SELECT * 
  FROM users, friends
  WHERE users.Role =  "User"
  AND users.call = :random
  OR (users.ID = friends.ID_USER
  AND friends.random =  :random)
  </code></pre>
  
  <p>Any solution?</p>