title: Mysql Left Join on multiple conditions
body: <p>I have two tables as below:
  User table:</p>
  
  <pre><code>CREATE TABLE `user` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(255) NOT NULL,
      PRIMARY KEY (`id`)      
  );
  </code></pre>
  
  <p>And another table as uep which as below:</p>
  
  <pre><code>CREATE TABLE `uep` (
    `user_id` int(10) unsigned NOT NULL,
    `email_template_id` int(10) unsigned NOT NULL,
    `sid` int(10) unsigned NOT NULL,
    `send_email` tinyint(1) NOT NULL DEFAULT '1'
  );
  </code></pre>
  
  <p>I want to get all records from user table and do <code>left</code> join to <code>uep</code> table only when<br>
  <code>user.id = uep.user_id AND uep.send_email = 0</code></p>
  
  <p>but when i run query </p>
  
  <pre><code>Select id, group_concat(email_template_id) as T from user
  LEFT join uep ON (user.id = uep.user_id AND uep.send_email = 0)
  group by user_id limit 100
  </code></pre>
  
  <p>It ignore user from user table which are having send_email = 1.</p>
  
  <p>I want to join uep table only when user.id and send_email =0 else it should be not join and return only user details.</p>
  
  <p>Sql Fiddle :<a href="http://www.sqlfiddle.com/#!2/1f083/2" rel="nofollow">http://www.sqlfiddle.com/#!2/1f083/2</a></p>
  
  <p>Any help appricated!!</p>