I have the following example.
Doc_NO Ref1 Ref 2 Ref3 123 TAR Inv NULL 456 TAR NULL NULL 789 Inv NULL TAR
I need to check all three columns. If a doc_no has TAR in one column and null in the other two, I need it returned in my script result. In the case above, the script should only return Doc_no 456, as it is the only one that has TAR in one of the Ref columns and NULL in the remaining two.
where (ref1 = 'TAR' and ref2 is null and ref3 is null) or (ref1 is null and ref2 = 'TAR' and ref3 is null) or (ref1 is null and ref2 is null and ref3 = 'TAR')
Will this script I wrote work correctly?