title: Medoo PHP framework - 'select' 'left join' using 'and' to test against a condition (as in col = val)
body: <p>I'm trying to make a left join select and use AND to compare a column against a specific value, i.e. a condition.</p>
  
  <p>The problem is I don't know where to add the condition.  The below medoo query returns the first shirt id of the same user id even if all 'is_wearing_shirt' set to 0.  A regular mysql query however returns the expected data.</p>
  
  <p>Here's the medoo query:</p>
  
  <pre><code>$db-&gt;select('users', array(
      '[&gt;]shirts' =&gt; array(
          'user_id' =&gt; 'shirt_owner_id',
          'is_wearing_shirt' =&gt; 1 // equivalent to AND is_wearing_shirt = 1
      )
  ), array(
      'user_id',
      'shirt_id(shirt_id_being_worn)'
  ) , array(
      'user_id' =&gt; 1,
      'LIMIT' =&gt; 1
  ));
  // always returns a shirt_id (even if all rows have is_wearing_shirt set to 0, in which case, shirt_id should be null)
  </code></pre>
  
  <p>Here's the regular MySQL query that works:</p>
  
  <pre><code>SELECT u.user_id, s.shirt_id
  FROM  `cvs_users` u
  LEFT JOIN `shirts` s
      ON user_id = shirt_owner_id
      AND shirt_being_worn = 1
  WHERE user_id = 1
  //returns the correct shirt_id
  </code></pre>