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: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: 18 Feb 2003 22:58:16 GMT
Message-ID: <b2udq8$1h116d$1@ID-82536.news.dfncis.de>

This is still too little information to help you. Does your table always have only two rows, one of which is host and the other is port? Does name only have host/port pairs or are there more strings allowed. Does every row containing a host have a corresponding port row and vice versa?

Rene

> 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.
> 
> 
> 
> Reid Lai <reidlai_at_reidlai.com> wrote in message news:<3E4E36AE.80804_at_reidlai.com>...

>> If you are talking to build up matrix dynamically, there is no way in
>> SQL only. You must find other client tools to do so, like Privot Table
>> in Excel, etc.
>>
>> ayrobins wrote:
>>
>> > Hi guys,
>> >
>> > this should be easy but i cannot figure out how to do this.
>> > The purpose of this is to create a view out of a name/value table and
>> > make each name a column.
>> >
>> > create table tst
>> > (
>> > a integer,
>> > n varchar(10),
>> > v varchar(10)
>> > );
>> >
>> > insert into tst values(1, 'name1a', 'value1a');
>> > insert into tst values(1, 'name1b', 'value1b');
>> > insert into tst values(2, 'name2a', 'value2a');
>> > insert into tst values(2, 'name2b', 'value2b');
>> >
>> > select a, v from tst where a in (1);
>> >
>> > which gives me:
>> > A V
>> > ---------- ----------
>> > 1 value1a
>> > 1 value1b
>> >
>> > What i want is to put the values associated with the same 'a' on 1 row.
>> > So i want to see 1 row consisting of '1, value1a, value1b'.
>> >
>> > thanx in advance
>> > anthony
>> >
-- 
  no sig today
Received on Tue Feb 18 2003 - 16:58:16 CST

Original text of this message

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