exclude records which match on both tables sql
<p>Its not a duplicate of another question because  I have two tables , when inner joined on there t-numbers should exclude the search criteria  and I cant use distinct on search criteria.</p>

<p>I  have two tables</p>

<p>Table A :</p>

<pre><code>T_ref            t_number
VC04706610      1369473
VC0484351A      1357916 
VC04882679      1311572
</code></pre>

<p>Table B :</p>

<pre><code>t_number  thr_hold_type
1369473    2877417
1369473    2877657
1357916    2877417
1357916    2877635
1357916    2877697
1311572    2877637
1311572    2877572
</code></pre>

<p>I want to exclude records which have hold type 2877417.</p>

<p>Query :</p>

<pre><code>SELECT t_ref
 FROM table a
 INNER JOIN table b
     ON b.t_number = a.t_number
 WHERE thr_hold_type NOT IN ('2877417') 
     AND t_reference IN ( 'VC04706610', 'VC0484351A',b'VC04882679', 'VC04885203')
</code></pre>

<p>When i run this query it brings up all other hold types I want to completely exclude these t_references which has that hold type..</p>