Page 1 of 1

DB2 table comparison within the same table.

Posted: Sat Jan 15, 2022 2:54 pm
by Ashit Shah
Hello,

Good evening,

In a Db2 table, I have 10 rows and I want to compare each of the record with the remaining records. How to achieve this?

Re: DB2 table comparison within the same table.

Posted: Wed Jan 26, 2022 10:29 am
by Anuj Dhawan
Without knowing a lot of details - you most likely looking for an inner join in DB2. Like below example:

Code: Select all

SELECT column_name(s)
FROM table1 t1 INNER JOIN table1 t2 
on t1.column1 = t2.column1;
Would recommend to read further on 'inner join in DB2'. If that does not help, please add more details to your question.