title: mysql I don´t understand the if meaning here
body: <pre><code> $sql = "select u.Id, u.username, u.email, (NOW()-u.authenticationTime) as authenticateTimeDifference, u.IP, 
            f.providerId, f.requestId, f.status, u.port 
         from friends f
         left join users u on 
            u.Id = if ( f.providerId = ".$userId.", f.requestId, f.providerId ) 
         where (f.providerId = ".$userId." and f.status=".USER_APPROVED.")  or 
             f.requestId = ".$userId." ORDER BY u.username ASC";
  </code></pre>
  
  <p>I don´t understand the if meaning here , being used with where</p>
  
  <pre><code>// providerId and requestId is Id of  a friend pair,
  // providerId is the Id of making first friend request
  // requestId is the Id of the friend approved the friend request made by providerId
  
  // fetching friends, 
  // left join expression is a bit different, 
  //  it is required to fetch the friend, not the users itself
  </code></pre>
  
  <p>anyone can explain it for me ? thanx </p>