Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: sql select question

Re: sql select question

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Wed, 19 Feb 2003 09:13:44 +0000
Message-ID: <b2vat8$rrh$1@ctb-nnrp2.saix.net>


ayrobins wrote:

> All i want is to transform the name of a name/value table into a specific
> column.
> specifically i have a table called conn_address
>
> name value
> --------- ----------------
> host xxx
> port 123
>
> so i want to do a select on conn address where the result would be.
> xxx 123
> on the same row.

Try something like this:

SQL> create table tst ( a number, b varchar2(20), c varchar(20) );

Table created.

SQL> insert into tst values( 1, 'name1', 'value1' );

1 row created.

SQL> insert into tst values( 1, 'name2', 'value2' );

1 row created.

SQL> insert into tst values( 2, 'name3', 'value3' );

1 row created.

SQL> insert into tst values( 2, 'name4', 'value4' );

1 row created.

SQL> insert into tst values( 3, 'name5', 'value5' );

1 row created.

SQL> SELECT
  2 t1.c, t2.c
  3 FROM tst t1, tst t2
  4 WHERE t1.a = t2.a
  5 AND t1.b < t2.b;

C                    C
-------------------- --------------------
value1               value2
value3               value4


--
Billy
Received on Wed Feb 19 2003 - 03:13:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US