DB2 table comparison within the same table.

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Ashit Shah
New Member
Posts: 7
Joined: Thu Apr 24, 2014 12:00 pm

DB2 table comparison within the same table.

Post 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?
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: DB2 table comparison within the same table.

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”