Can someone correct me if i use to compare the 1st 5 fields between 2 tables... will the below condition work? when i run the below condition, then i am getting records which are equal to rather than not equal to.
SELECT * FROM TABLE 1 C
, TABLE 2 G
WHERE EMP1 = EMP2
AND ((C.ORIGIN,1,5) <> (G.ORIGIN,1,5)
OR (C.DEST,1,5) <> (G.DEST, 1,5) ) ;
use SUBSTR function to get the first few chars of the column value.
and if you you are using two not equal to conditions, i think it should be connected with logical operator AND rather than OR.
SELECT * FROM TABLE 1 C
, TABLE 2 G
WHERE EMP1 = EMP2
AND (SUBSTR(C.ORIGIN,1,5) <> SUBSTR(G.ORIGIN,1,5)
AND SUBSTR(C.DEST,1,5) <> SUBSTR(G.DEST, 1,5) ) ;