How to do SELECT UNIQUE on multiple fields

Hello,

I have a table with the following columns:

A.KEY
A.VAL1
A.VAL2

A.KEY is unique. A.VAL1 and A.VAL2 may have any values.

Is it possible to do a SELECT UNIQUE using multiple fields from table A?

If table A has these values:

KEY    VAL1    VAL2
  1        A         B
  2        C         D
  3        A         B
  4        C         D
  5        A         B
  6        E         F

I would like the select to return rows made up of unique values in both VAL1 and VAL2. It should produce the following:

A  B
C  D
E  F

I've been using this code to deal with it:

  SELECT UNIQUE(STUFF)
  FROM (SELECT (VAL1 || '^' || VAL2) STUFF FROM A)

Is there a better way to do this? What is "The Oracle Way"?

Points will be awarded to the most elegant, correct solution.

Thanks for the help.

Jim
jrollins138Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hans_vdCommented:
select distinct val1, val2 from a
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pennnnCommented:
SELECT DISTINCT val1, val2 FROM A;
Hope that helps!
0
jrollins138Author Commented:
I knew there had to be something easy.

Thanks folks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.