title: Use of CASE with criteria from multiple tables
body: <p>I have to do a select query to create a view with specific criteria.</p>
  
  <p>I have multiple tables which contains many many columns and lines.</p>
  
  <p>However, I have extracted a value to use as my key (e.g.: id). I have 7000+ of those unique keys that I extracted from all my tables with the function UNION to avoid duplicates.</p>
  
  <p>Now, I want to add a column INDICATOR_1 which will affect the value YES or NO based on criteria.</p>
  
  <p>This is where I struggle.</p>
  
  <p>I need to find the line in those tables that contain the id. After that, I'd like to check, always in that line, if the field XYZ contains the value 'N' (example). If yes, affect the value 'YES' to INDICATOR_1, else it's no.</p>
  
  <p>In a matter of pseudo-code, what I want to do looks like this :</p>
  
  <pre><code>CASE
      WHEN id = (id from table_1) AND (if table_1.xyz = 'N') 
         THEN 'YES'
         ELSE 'NO'
  END AS INDICATOR_1
  </code></pre>
  
  <p>I don't know if I'm clear enough, but your help will be greatly appreciated.</p>