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.

Question about finding composite non-unique columns

477011Dec 23 2005 — edited Dec 27 2005
I am a fairly new Oracle student and recently was racking my brain over this issue:

Lets say I have a table like this:

KEY A B
1 1 1 <--
2 1 1 <-- Non-Unique Combination
3 1 2
4 2 2 <--
5 2 2 <-- Non-Unique Combination

What I want to do is locate one of the KEYs where the combination of A and B are not unique (and delete one of the rows but dont sweat that now). In this case the solution would be KEY 2 (or 1) and KEY 4 (or 5). Basically the output I would like to get is something along the lines of:

KEY
2
5

Any ideas on how I can swing this? (Sorry about the table formatting, any tips on how to better represent data on these forums? I have noticed some people manage to post beautiful tables on here, just not sure how.)

Comments

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

Post Details

Locked on Jan 24 2006
Added on Dec 23 2005
8 comments
2,803 views