OiO.lk Blog SQL Get the non-matching rows in SQL
SQL

Get the non-matching rows in SQL


We have two SQL tables

and .

Now, We have to do a merger of these two table in such a way that, table_1 seq_number which is not present in table_2, map with the tp_no = 0 Like this.

We have to create this in SQL table so it could be used further.

I am trying to achieve this by:

select distinct tar.c_Id,brd.Toucpoint,brd.sequence_number,tar.tot_Id,tar.tp_no
from table_2 tar 
inner join (
     select distinct c_Id,channel,sequence_number
     from table_1
) brd on tar.c_Id = brd.c_Id and tar.tp_no <> brd.sequence_number
where tar.tp_no = '0';

But this is not giving the desired output.



You need to sign in to view this answers

Exit mobile version