title: SQL QUERY using LEFT JOIN and CASE Statement
body: <p><strong>here is an example of my two table.</strong></p>
  
  <p><img src="https://i.stack.imgur.com/5964x.png" alt="enter image description here"></p>
  
  <p><strong>PROBLEM:</strong>
  How can I create SQL Query using left join?</p>
  
  <p><strong>HERE IS THE SCENARIO</strong></p>
  
  <p>As I've said earlier, I have two table (TABLE1 and TABLE2),
  I tried to use left join so that i can combine both UserID
  in one table</p>
  
  <p><strong>so here is the code</strong></p>
  
  <pre><code>select * from table1 a left join table2 on a.userid = b.userid
  </code></pre>
  
  <p>so two tables are now combined.</p>
  
  <p><strong>what i need to do is this:</strong> <br/>
  if the status is <strong>all complete</strong> then 'complete' <br/>
  then if status contains <strong>complete and incomplete</strong> then 'incomplete' <br/>
  else 'no status' <br/></p>
  
  <p>it should be look like this.</p>
  
  <p><img src="https://i.stack.imgur.com/ZWTSG.png" alt="enter image description here"></p>
  
  <p><strong>NOTE</strong>: <br/>
  since <strong>UserID = 1</strong> (table1) contains <strong>complete and incomplete</strong> status (table2) <br />
  then it display <strong>'incomplete'</strong> (new column) <br />
  <br />
  since <strong>UserID = 4</strong> (table1) contains <strong>all complete</strong> status (table 2) <br />
  then it display <strong>'completed'</strong> (new column)<br /></p>
  
  <h2>-----------------------------------</h2>
  
  <p><strong>WHAT IF I CHANGE THE STATUS TO INTEGER?</strong></p>
  
  <p><img src="https://i.stack.imgur.com/gfIxr.png" alt="enter image description here"></p>
  
  <p>same procedure. thanks </p>