Hello Experts,
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.
from TableA A
inner join TableB B on B.A = A.A and B.B = A.B and B.C = A.C
union all
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 an 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 the above query to produce a result of the TableA and TableB, look like the following:
TableA
TableB
As you can see there is not only a match on ABC, but also on B
Please let me know if you need further information
carlton