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: Reid Lai <reidlai_at_reidlai.com>
Date: Sat, 15 Feb 2003 20:46:38 +0800
Message-ID: <3E4E36AE.80804@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
>
Received on Sat Feb 15 2003 - 06:46:38 CST

Original text of this message

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