Can someone help modify a SQL script.
The following script will compare columns A B C from TableA and TableB and if it sees a match will output the rows as shown in the following image.
select convert(VARCHAR,0) Is_Deleted, A.A, A.B, A.C, A.D, A.E, A.F
from TableA A
inner join TableB B on B.A = A.A and B.B = A.B and B.C = A.C
select convert(VARCHAR,1) Is_Deleted, B.A, B.B, B.C, B.D, B.E, B.F
from TableB B
inner join TableA A on A.A = B.A and A.B = B.B and A.C = B.C
order by A, B, C
However, I would like the code modified. I still need sql to find a match on columns A B C but only produce the same output if Column B have the same record, of say bb. At moment, the query matching if all Columns are the same. So because there is a match of xx PP dd the query is providing an output, but I only need the output if the columns were xx bb and dd.
So I only want an output if TableA and TableB look like the following,
As you can see there is a match on xx bb dd
Please let me know if you need further information