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.
I have two tables
Table A :
T_ref t_number
VC04706610 1369473
VC0484351A 1357916
VC04882679 1311572
Table B :
t_number thr_hold_type
1369473 2877417
1369473 2877657
1357916 2877417
1357916 2877635
1357916 2877697
1311572 2877637
1311572 2877572
I want to exclude records which have hold type 2877417.
Query :
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')
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..