I have the below tables . Table 1has all the primary values and should be retained. Table 2 can have the same ID in table 1 and same codes when this occurs table 1 primary values should be returned .only return table 2 values when ID are same and codes are different, table 2 primary value is always 0
Table 1
ID,codes,row,primary,type
2,23,3,1,customer
2.54,6,1,customer
Table 2
ID,codes,row,primary,type
2,23,3,0,customer
2,24,6,0,customer
Expected result
ID,codes,row,primary,type
2,23,3,1,customer
2,24,6,0,customer
2.54,6,1,customer