title: Join tables with same keys, second table has multiple values for key and rows of second table must have same column value
body: <p>I have two tables with shared key and I'm trying to join them to filter data based on few conditions</p>
  
  <p>tbl1</p>
  
  <pre><code>id    | OutPutValue  | 
  1     | 2019         |
  2     | 2018         |
  </code></pre>
  
  <p>tbl2</p>
  
  <pre><code>object_id      | status  |  type |
  1              | 22      |  a    |
  1              | 22      |  c    |
  1              | 33      |  b    |
  2              | 33      |  c    |
  2              | 33      |  c    |
  2              | 33      |  c    |
  </code></pre>
  
  <p>What I'm trying to get is : it must select all <code>'OutPutValue'</code> from tbl1 where, in tbl2 column <code>'type'</code> should be c, and column <code>'status'</code> must have same value for all rows i.e. 33. Note that Primary key (id) of tbl1 is foreign key (object_id) in tbl2.</p>
  
  <p>Select column from tbl1 if, All rows in tbl2 (id of tbl1 have multiple rows (based on object_id) in tbl2) have same <code>status</code> value i.e. 33 and Type should be 'c'.</p>
  
  <pre><code>OutPutValue    | Type   |  status  |
  2018           | c      |  33      |
  </code></pre>
  
  <p>I have tried with following solution, but it's not returning desired output : </p>
  
  <pre><code>SELECT a.OutPutValue FROM tbl1 a JOIN tbl2 b ON a.id = b.object_id WHERE b.Type =c
  GROUP BY a.OutPutValue, b.status HAVING b.STATUS IN(33)
  </code></pre>