Another SQL query help

  • From: john scott <joscott2011.mail@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 24 Feb 2011 13:56:35 -0500

I am scrathing my head to write a SQL query to get this information:

I have two tables t1 and t2  with these values

Table t1
======
Col1        Col2
------         ------
1             One
2             Two
3             Three

Table t2
=======
Col1       Colx
------        -------
1            Xone
2            Xtwo
2            Xtwotwo
3            XThree

I need to select Col2 from Table t1 and Colx from Table t2 with only
distinct values for Col1.

Here is what I am expecting

t1.Col2           t2. Colx
----------           -----------
One               Xone
Two               Xtwo
Three            XThree

In t2.Colx value Xtwotwo is also acceptable as I need only one distinct
value from t1.Col2 and don't care for
whatever shows up under t2.Colx.

Any suggestions?

Thanks,
John

Other related posts: