If you need to compare some fields in row in SELECT statement, you can do this with CASE expression :
SELECT A.data_queue_name,
A.data_queue_library,
A.current_messages,
B.current_messages,
CASE
WHEN
A.current_messages = B.current_messages
THEN ' '
ELSE '**diff**'
END
FROM swtgemts1 A JOIN swtgemts2 B ON A.data_queue_name = B.data_queue_name;
HBCLNT | ICBSDAT | 0 | 0 | |
HBCLNTCTL | ICBSDAT | 0 | 0 | |
HBIAS1CTL | ICBSDAT | 0 | 0 | |
HBIAS2CTL | ICBSDAT | 0 | 0 | |
HBIAS3CTL | ICBSDAT | 0 | 0 | |
HBIAS4CTL | ICBSDAT | 0 | 0 | |
HBIAS5CTL | ICBSDAT | 0 | 0 | |
HBMULTCTLX | ICBSDAT | 4100 | 4100 | |
HBPX000 | ICBSDAT | 30 | 24 | **diff** |