title: MYSQL SELECT JOIN with condition
body: <p>I'm working on a tricky query and just don't understand how to approach it since neither JOIN gives me desirable result.</p>
  
  <p>I have two tables:</p>
  
  <pre><code>Table1:
  id
  value
  
  Tabel2:
  id
  table1_id
  parameter (1,0)
  value
  </code></pre>
  
  <p>I need to select everything from Table_1, but if there is a row in Table2 with table1_id = table1.id and parameter = 1, I want to include table2.value in the outcome. Note, that there can be multiple rows with table1_id = table1.id in Table2, but only one with parameter=1.</p>
  
  <p>So, what I'm looking to get as a a result</p>
  
  <pre><code>table1.id | table1.value | table2.parameter |table2.value
      1     |      v1      |                  |      
      2     |      v1      |         1        |      v2
      3     |      v1      |                  |      
      4     |      v1      |         1        |      v2
  </code></pre>
  
  <p>Can someone help me with a query. Thank you for your time.</p>