title: update tables based on rows in it and other table
body: <p>Below are the tables that i work on - </p>
  
  <p>table_ctrl_result - </p>
  
  <pre><code>seq_id  req_id  ctrl_id c1  c2  status
  1       1       C001    DES 380 NULL
  2       1       C001    ABC 0   NULL    
  3       1       C001    EDC 0   NULL
  </code></pre>
  
  <p>TABLE_CTRL_MSTR - </p>
  
  <pre><code>ctrl_id tolerance   symbol
  c001    1000        &lt;
  </code></pre>
  
  <p>Below is the expected result,</p>
  
  <pre><code>seq_id  req_id  ctrl_id c1  c2  status
  1       1       C001    DES 380 PASS
  2       1       C001    ABC 0   PASS
  3       1       C001    EDC 0   PASS
  </code></pre>
  
  <p>I am using the query thats mentioned in the comment , but I am getting the below result.,               </p>
  
  <pre><code>seq_id  req_id  ctrl_id c1  c2  status
  1       1       C001    DES 380 PASS
  2       1       C001    ABC 0   FAIL
  3       1       C001    EDC 0   FAIL
  </code></pre>
  
  <p>SQL:</p>
  
  <pre><code>update ca_demo.table_ctrl_result a 
  set a.STATUS = (
    select 
    (case 
     when b.symbol = '&gt;' and a.c2 &gt; b.tolerance or b.symbol = '&lt;' and a.c2 &lt; b.tolerance or b.symbol = '=' and a.c2 = b.tolerance 
     then 'PASS' 
     else 'FAIL' 
     end) 
    from ca_demo.table_ctrl_mstr b 
    where a.ctrl_id = b.ctrl_id 
  ); 
  </code></pre>
  
  <p>I'm missing something. Please assist.</p>