Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Create groups of related column values

Dibyendu ChakrabortyMay 28 2010 — edited May 29 2010
Hi,
I have a table, say t1 (create table t1 (c1 number, c2 number)). The column C1 hold a set of persons which are related to C2. Now I want to create groups which are related.
the insert script is as below:
insert into t1 values(120, 110);
insert into t1 values(130, 110);
insert into t1 values(130, 170);
insert into t1 values(170, 180);
insert into t1 values(220, 210);
insert into t1 values(220, 200);
insert into t1 values(220, 190);
insert into t1 values(230, 220);
insert into t1 values(280, 270);
insert into t1 values(280, 260);
insert into t1 values(280, 250);

So, the records in the target table will be like:

groupid c3
-----------------------------------------
1 120
1 110
1 130
1 170
1 180
2 220
2 210
2 200
2 190
2 230
3 280
3 270
3 260
3 250

Please let me know how can I do that?
Hierarchical query is not helping me. The original table number of records are around 50K.

Please. This is urgent.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 25 2010
Added on May 28 2010
10 comments
1,646 views