Path: news.cambrium.nl!textnews.cambrium.nl!feeder3.cambrium.nl!feeder4.cambrium.nl!feed.tweaknews.nl!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.82.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Date: Tue, 03 Mar 2009 09:10:52 +0100
From: Shakespeare <whatsin@xs4all.nl>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.server
Subject: Re: display table row into column
References: <1ae25a52-a639-4729-8c17-8582ae44330f@e24g2000vbe.googlegroups.com> <2f621a72-af0f-49ac-bde3-d38c7b579c2a@l33g2000pri.googlegroups.com>
In-Reply-To: <2f621a72-af0f-49ac-bde3-d38c7b579c2a@l33g2000pri.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 62
Message-ID: <49ace610$0$191$e4fe514c@news.xs4all.nl>
NNTP-Posting-Host: 82.95.215.210
X-Trace: 1236067856 news.xs4all.nl 191 [::ffff:82.95.215.210]:50218
X-Complaints-To: abuse@xs4all.nl
Xref:  news.cambrium.nl

srinivasarao22@gmail.com schreef:
> On Feb 26, 5:48 pm, shweta.kapar...@googlemail.com wrote:
>> Hi All
>>
>> I have :
>>
>> SQL> create table t1( col1 varchar2(10), col2 varchar2(10),col3
>> varchar2(10));
>>
>> Table created.
>>
>> SQL>
>>
>> SQL>  insert into t1(col1,col2,col3) values ('A','B','C');
>>
>> 1 row created.
>>
>> SQL> insert into t1(col1,col2,col3) values ('D','E','F');
>>
>> 1 row created.
>>
>> SQL>  insert into t1(col1,col2,col3) values ('G','H','I');
>>
>> 1 row created.
>>
>> SQL> commit;
>>
>> Commit complete.
>>
>> SQL> select * from t1;
>>
>> COL1       COL2       COL3
>> ---------- ---------- ----------
>> A          B          C
>> D          E          F
>> G          H          I
>>
>> i want to write select query which should give me the output:
>> as
>>
>> col1    col2    col3
>> ----     ------    ------
>> B       E        H
>>
>> Regards
>>
>> Shweta
> 
> 
> 
>  SELECT  (SELECT col2 FROM t1 WHERE col1='A') col1,(SELECT col2 FROM
> t1 WHERE col1='D') col2,(SELECT col2 FROM t1 WHERE col1='G') col3 FROM
> t1
> WHERE  ROWNUM<2
> 

Duh.... why not:
select 'B' col1, 'E' col2, 'H' col3 from dual?
If you want to hard-code your queries, be consequent!


Shakespeare
